I have a large dataframe (14552 rows by 15 columns) containing billing data from 2001 to 2007. I have used sqlFetch to get 2008 data. In order to append the 2008 data to the data of the preceding 7 years one would do as follows
alltime <-rbind(alltime,all2008)
Unfortunately that generates
Warning message: In
[<-.factor
(*tmp*
, ri, value = c(NA, NA, NA, NA, NA, NA, NA, : invalid factor level, NAs generated
My guess is that there are some new patients whose names were not in the previous dataframe and therefore it would not know what level to give it. Another column is for the name of the referring doctor. A new referring doctor would cause the same problem.
The way R imports data and automatically works out what is numeric and what is not (and thereby makes it a factor) is wonderful - untill you have to manipulate it further and then it becomes a pain. How do I overcome my problem elegantly?