Skip to content
Prev 302813 / 398506 Next

reshape2's dcast() Adds NAs to Data Frame

The explanation is that this is normal and consistent with behavior of factors in general.  If you don't want that, it is common to work with character data instead of factors, only converting to factor when needed. In most cases I invoke read.table with the as.is=TRUE argument and delay converting to factors until I need them. Other people convert from factor to character and back to factor to get rid of unwanted factor levels on an as-needed basis.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Rich Shepard <rshepard at appl-ecosys.com> wrote: