博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
R语言练习题2
阅读量:355 次
发布时间:2019-03-04

本文共 622 字,大约阅读时间需要 2 分钟。

关注公众号凡花花的小窝,收获更多的考研计算机专业编程相关的资料

3、从mtcars数据集中取出wt>2.6并且vs=0的数据。
subset(mtcars,mtcarsKaTeX parse error: Expected 'EOF', got '&' at position 7: wt>2.6&̲mtcarsvs0)
2)install.packages(“sqldf”)
library(sqldf)
sqldf(“select * from mtcars where wt>2.6 and vs=0”,rownames=TRUE)
a<-which(mtcarsKaTeX parse error: Expected 'EOF', got '&' at position 7: wt>2.6&̲mtcarsvs
0)
mtcars[a,]
3)取数据集中vs=0的所有wt的值3.
attach(mtcars)
wt[vs==0]
detach(mtcars)
4、从R自带airquality数据集中取出Temp值大于80 的Ozone、Temp列的值。
attach(airquality)
subset(airquality[,c(1,4)],Temp>80)
detach(airquality)
5、定义字符串data为“R语言是一门艺术”,data1为“用心去体会”,将两字符串进行连接,并用冒号分隔。统计连接后字符串的长度。

转载地址:http://pzxh.baihongyu.com/

你可能感兴趣的文章