Hi Benoit,
This happens because R ‘assumes’ that a column of class factor in a data.frame has all possible levels. In your example, the “a” and “c” levels of “f” are in separate data.frames. Because R doesn’t understand all the possible levels in each data.frame (i.e., “a”, “b”, and “c”), but only the ones that are present, it converts the “f” column in each data.frame to class character before combining the two. Character vectors don’t have that restriction.
Converting to factors to character before “rbind”-ing or merging, will get around this warning message. If you need to recode the column to factor for your analysis, after combining the data you can do:
out <- rbind(a, b)
out$f <- as.factor(out$f)
Good luck,
Patrick