[R] Using as.formula() with the reshape package cast
hadley wickham
h.wickham at gmail.com
Tue Apr 7 16:32:15 CEST 2009
On Tue, Apr 7, 2009 at 8:44 AM, <ryan.sheftel at malbecpartners.com> wrote:
>
> I am trying to use the "cast" function from the reshape package, where the
> formula is not passed in directly, but as the result of the as.formula()
> function.
>
> Using reshape v. 0.7.2
>
> I am able to properly melt() by data with:
>
>> molten <- melt(x, id=1:2)
>
> then I can properly cast with this:
>
>> cast(molten, days ~ variable)
>
> but if I try
>
>> cast(molten, as.function("days ~ variable"))
You're calling as.function ;) Also, I think you should be able to
pass the string directly - reshape will convert it to a formula for
you.
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list