R常用操作

##检查数据的维度
dim(iris)

##显示数据集的内部结构
str(iris)

##显示数据集的属性
attributes(iris)

##显示数据集中每个变量的分布情况
summary(iris)

##显示iris数据集列Species中各个值出现频次
table(iris$Species)

##根据列Species画出饼图
pie(table(iris$Species))

##画出列iris$Sepal.Length分布柱状图
hist(iris$Petal.Length)

##画出列iris$Sepal.Length的密度函数图
plot(density(iris$Petal.Length))

##画出列iris$Sepal.Length和iris$Sepal.Width的散点图
plot(iris$Sepal.Length,iris$Sepal.Width)

##绘出矩阵各列的散布图
plot(iris)
pairs(iris)
原文地址:https://www.cnblogs.com/tgzhu/p/7299166.html