Try str(svy) and see what formats the seperate variables have.  It may give you 
a clue as to what is happening.  

An alternative approach is to see if the reshape package can help you.  
See See http://had.co.nz/reshape for more information on the package.


--- On Sat, 9/27/08, Keith Schnakenberg <[EMAIL PROTECTED]> wrote:

> From: Keith Schnakenberg <[EMAIL PROTECTED]>
> Subject: [R] reshape "Error in data[, timevar] : incorrect number of 
> dimensions"
> To: r-help@r-project.org
> Received: Saturday, September 27, 2008, 4:57 PM
> 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.

______________________________________________
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