Just use match and do factor_ at the R level