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"))
if returns the error:
Error in check_formula(formula, varnames) :
Formula contains variables not in list of known variables
I am not sure if the problem is with cast or as.formula()
I did confirm that:
> x <- days ~ variable
> y <- as.formula("days ~ variable")
> x==y
TRUE
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.