[R] reshape2's dcast() Adds NAs to Data Frame
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Wed Aug 8 02:04:00 CEST 2012
Need sample data, and code that demos the problem.
---------------------------------------------------------------------------
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:
> 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
>
>______________________________________________
>R-help at 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.
More information about the R-help
mailing list