Reputation: 115
I have a datafile(math) and then I created ID variable. I tried to combine them into one datafile WITH all the variable names in 'math' and 'id'.
I keep saving the combined file without variable names. I might have not used read.spss or write.table function properly. What did I miss?
math="2009_Math.sav"
m=read.spss(math,use.value.labels=false)
mathid<-c(1:65535)
names(mathid)<-c("id")
mathfile<-data.frame(math,mathid)
write.table(m2009, file="math2009.sav",sep=",",row.names=F,col.names=T,quote=F,append=T)
Upvotes: 0
Views: 2225
Reputation: 21882
Still not sure what you're asking, but I think what you want is:
filename <- "2009_Math.sav"
m <- read.spss(filename, use.value.labels=false)
m$id <- 1:nrow(m)
write.table(m, file="math2009.csv",sep=",",row.names=F,col.names=T,quote=F,append=T)
Upvotes: 1