[R] question regarding cast function in reshape package with mixture of numeric and character

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Sep 26 23:39:11 CEST 2013


I am baffled. Just what do you want it to do? In melted form the data are all in one column and so are necessarily of one type... there are no mixed types to cast.

As usual, assistance here will be more useful when you follow the Posting Guide and post plain text only and give reproducible examples including dput input data and references to all packages used.
---------------------------------------------------------------------------
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.

Jack Luo <jluo.rhelp at gmail.com> wrote:
>Hi,
>
>I am trying to process some data frame with cast function to unwind the
>stacked variables. I have no problem using cast when the values are all
>numeric based on the following format:
>
>cast(df,subject~v1+v2+v3....,value = "value",fun.aggregate = mean, fill
>=
>"NA")
>
>However, I am getting some trouble when the "value" variable has a
>mixture
>of numeric and character.
>
>I played around dropping off the fun.aggregate = mean option, but it
>use
>the default: which is the length and not what I want.
>
>I am wondering if there is anyway of doing this?
>
>Many thanks,
>
>-Jack
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>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