[R] Help

Silika Tereshchenko silika at access.unizh.ch
Sun Jul 6 22:25:46 CEST 2003


Dear all,



I have the problem, please, help me. I tried to import the dataset from the SPSS
into the R. It is the panel (survey). The importing of the data show that my
variables are read as afactor in R. But I need the variable "income" as a
numeric one. I tried to use the following command:   

 for(i in
c("AGE99","AGE00","I99PTOT","I00PTOT","I99PTOTN","I00PTOTN","I99PTOTG","I00PTOTG"))
+ {df[[i]]<-as.numeric(df[[i]])}
 
and then I get the error message. 
Error in "[[<-.data.frame"(*tmp*, i, value = as.numeric(df[[i]])) : 
        replacement has 1 rows, data has 6335

What can I do? Could you please help me. I need it for my work.

Dear all,



I have the problem, please, help me. I tried to import the dataset from the SPSS
into the R. It is the panel (survey). The importing of the data show that my
variables are read as afactor in R. But I need the variable "income" as a
numeric one. I tried to use the following command:   

 for(i in
c("AGE99","AGE00","I99PTOT","I00PTOT","I99PTOTN","I00PTOTN","I99PTOTG","I00PTOTG"))
+ {df[[i]]<-as.numeric(df[[i]])}
 
and then I get the error message. 
Error in "[[<-.data.frame"(*tmp*, i, value = as.numeric(df[[i]])) : 
        replacement has 1 rows, data has 6335

What can I do? Could you please help me. I need it for my work.




More information about the R-help mailing list