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

______________________________________________
R-help@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.

Reply via email to