coursera上面的R语言学习有个作业是这样的:给你个表格,问表格中Ozone这一列为空值(na)的个数
将csv表格导入到data变量中后,再执行下面语句
x<-data[is.na(data$Ozone),]
将所有Ozone值为na的行导入到X中,再由nrow函数计算出来即可
What is the mean of the Ozone column in this dataset? Exclude missing values (coded as NA) from this calculation.
x<-data[!is.na(data$Ozone),]
mean(x$Ozone)
Extract the subset of rows of the data frame where Ozone values are above 31 and Temp values are above 90. What is the mean of Solar.R in this subset?
y<-data[!is.na(data$Ozone)&data$Ozone>31&data$Temp>90,] mean(y$Solar.R)