[R] reshape package does not recognize second id variable

hadley wickham h.wickham at gmail.com
Mon Sep 29 02:55:53 CEST 2008


On Sun, Sep 28, 2008 at 6:45 PM, Keith Schnakenberg
<keith.schnakenberg at gmail.com> wrote:
> I am trying to use the reshape package for the first time. I have two waves
> of a survey, so the id variables include a subject identification number and
> a variable denoting the wave of the survey.
>
> I used the following arguments:
>
> library(reshape)
> svy.melt <- melt(svy, id=c("id", "WAVE"))
> svy.wide <- cast(svy.melt, id ~ WAVE + ...)
>
> and got the following error:
>
> "Error in check_formula(formula, varnames) :
>  Formula contains variables not in list of known variables"
>
> I check to make sure variable name is right, and it is:
>
> summary(svy$WAVE)
>   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>   1.00    1.00    1.00    1.47    2.00    2.00

What does the output of str(svy) and str(svy.melt) look like?

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list