I have read two .csv files and did some editing.
>a1<-read.csv("2013.csv",header=T, na.strings = c("NULL","PrivacySuppressed"))
>a2<-a1[,441,drop=F]
>a3<-a1[,-441,drop=F]
>a4<-cbind(a1,a2)
>a4<-a4[, colSums(is.na(a4)) != nrow(a4)]
> mode(a4)
>[1] "list"
I need the a4 to be an integer so I used sapply
> s<-sapply(a4, as.numeric)
> mode(s)
>
[1] "numeric"
However, the problem is, the column names disappeared.
> names(s)
>
NULL
All the previous datas had column names. Sorry it is impossible to type here since there are 600 variables (600 different column names). I had names for my column until a4. After apply "sapply", the names says "NULL". When I just input s, I see the names of the columns but it is not detecting them as names for columns. Please help. Thank you.
>a1<-read.csv("2013.csv",header=T, na.strings = c("NULL","PrivacySuppressed"))
>a2<-a1[,441,drop=F]
>a3<-a1[,-441,drop=F]
>a4<-cbind(a1,a2)
>a4<-a4[, colSums(is.na(a4)) != nrow(a4)]
> mode(a4)
>[1] "list"
I need the a4 to be an integer so I used sapply
> s<-sapply(a4, as.numeric)
> mode(s)
>
[1] "numeric"
However, the problem is, the column names disappeared.
> names(s)
>
NULL
All the previous datas had column names. Sorry it is impossible to type here since there are 600 variables (600 different column names). I had names for my column until a4. After apply "sapply", the names says "NULL". When I just input s, I see the names of the columns but it is not detecting them as names for columns. Please help. Thank you.