[R] reshape2's dcast() Adds NAs to Data Frame
Rich Shepard
rshepard at appl-ecosys.com
Tue Aug 7 23:45:41 CEST 2012
I need to understand how and why dcast() adds NAs to a data frame that
contained no missing values.
The database table of chemical concentrations has all missing values
removed because they cannot contribute to data analyses. The structure of
the R data frame of these data have no NA values, and neither does the data
frame resulting from applying the reshape2 melt() function to it. However,
the data frame produced by the dcast() function does contain NAs for all
chemicals. I assume this is because of the syntax I used:
chem.cast <- dcast(chem.melt, site + sampdate + era + ceneq1 + floor +
ceiling ~ param)
How should I reshape the data frame from long to wide without adding these
spurious NAs?
Rich
More information about the R-help
mailing list