cat("\014") rm(list=ls()) seo_rev=read.csv("D:\\hsong\\SkyDrive\\Public\\seo_kw_rev_train.csv", header=T, skip=2, na.string='.') names(seo_rev)<-tolower(names(seo_rev)) lapply(seo_rev, class) str(seo_rev) head(seo_rev) all_var<-colnames(seo_rev) ## check which variables have missing value, and how many of the values are missing getna<-function(x) sum(is.na(x)>0) apply(seo_rev, 2, getna)The output will list each variable's name with how many obs are missing for that variable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat("\014") | |
rm(list=ls()) | |
seo_rev=read.csv("D:\\hsong\\SkyDrive\\Public\\seo_kw_rev_train.csv", header=T, skip=2, na.string='.') | |
names(seo_rev)<-tolower(names(seo_rev)) | |
lapply(seo_rev, class) | |
str(seo_rev) | |
head(seo_rev) | |
all_var<-colnames(seo_rev) | |
## check which variables have missing value, and how many of the values are missing | |
getna<-function(x) sum(is.na(x)>0) | |
apply(seo_rev, 2, getna) |
No comments:
Post a Comment