On Wed, Nov 10, 2010 at 1:38 PM, <kurt_h...@nps.gov> wrote: > > Greetings > I'm attempting to insert missing data on the smallest size class of > cave cricket instars into a data frame. The data involve censusing > photoplots (plots) of roosting cave crickets in which we discern in four > instars or size classes. I need to insert data on size class one into a > data frame that already has data on size classes two through four. The > data can be merged by their cave name, year, month, region (near or far > from cave entrance), plot #, and Individual (IndID). For example: > (Embedded image moved to file: pic14606.jpg) > > As one example, I have data for size class (SC) one I can insert after > IndID #4 in the data above. However, when I attempt to merge these two > data frames using the following commands: > "Hs.full.anal<-merge(Hs.short.missgval,SC1_0608, > byx=c(Cave,Year,Month,Region,Plot,IndID), > byy=c(Cave,Year,Month,Region,Plot,IndID))" > I get the following message: > "WARNING: Warning in `[<-.factor`(`*tmp*`, ri, value = c(1L, 1L, 1L, 1L, > 1L, 1L, 1L, : > invalid factor level, NAs generated"
Hard to say with the level of detail you provided, but chances are that your data are converted (internally) to factors. If not too inconvenient, I would quit the R session without saving anything, restart and type options(stringsAsFactors=FALSE) before running anything. This prevents storing of character vectors as factors. If you already have a data frame that stores factors, you can try something along the lines of newFrame = apply(frame, 2, as.character) Hope this helps, Peter ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.