I have SPSS data, which I have to migrate to R. The data is large with 202 columns and thousands of rows
v1 v2 v3 v4 v5
1 USA Male 21 Married
2 INDIA Female 54 Single
3 CHILE Male 33 Divorced ...and so on...
The data file
contains variable labels "Identification No", "Country of origin", "Gender", "(Current) Year", "Marital Status - Candidate"
I read my data from SPSS with following command
data<-read.spss(file.sav,to.data.frame=TRUE,reencode='utf-8')
The column name is read as v1,v2,v3,v4
etc, but I want variable labels as my column name in data frame. I used following command to find the variable labels and set it as names
vname<-attr(data,"variable.labels")
for(i in 1:202){vl[i]<-vname[[i]]}
names(data)<-vl
Now the problem is that I have to address that column like data$"Identification number"
, which is not very nice. I want to remove quotation marks around the column names. How can I do that?