r - How to concatenate factors, without them being converted to integer level? -
i surprised see r coerce factors number when concatenating vectors. happens when levels same. example: > facs <- as.factor(c("i", "want", "to", "be", "a", "factor", "not", "an", "integer")) > facs [1] want factor not integer levels: factor integer not want > c(facs[1 : 3], facs[4 : 5]) [1] 5 9 8 3 1 what idiomatic way in r (in case these vectors can pretty large)? thank you. from r mailing list : unlist(list(facs[1 : 3], facs[4 : 5])) to 'cbind' factors, data.frame(facs[1 : 3], facs[4 : 5])