[R] reshape "Error in data[, timevar] : incorrect number of dimensions"
Keith Schnakenberg
keith.schnakenberg at gmail.com
Sat Sep 27 22:57:52 CEST 2008
I have two waves of a survey given to students at various middle
schools and high schools, with student id numbers for each student. I
am having difficulty reshaping the file from long to wide.
My code is below:
library(foreign)
svy <- read.spss("studsur4.SAV")
svy.wide <- reshape(svy, timevar="WAVE", idvar="id", direction="wide")
"id" is the student identification number, and "WAVE" takes values 1
and 2. I get the following error:
Error in data[, timevar] : incorrect number of dimensions
I would provide reproducible code but I can't reproduce the error
with any other data. I would appreciate any conjectures as to why
this is happening.
Thanks,
Keith
More information about the R-help
mailing list