##数据获取
x1=round(runif(100,min=80,max=100))
x2=round(rnorm(100,mean=80, sd=7))
x3=round(rnorm(100,mean=80,sd=18))
x3[which(x3>100)]=100
num=seq(2005138101,length=100)
x=data.frame(num,x1,x2,x3)
write.table(x, "grade.txt")
##数据分析
y=read.table("grade.txt")
mean(y)
colMeans(y)
colMeans(y)(c("x1","x2","x3"))
#//2代表按列取平均值
apply(x, 2, mean)
apply(x, 2, max)
apply(x, 2, min)
apply(x[c("x1","x2","x3")], 2, sum)
#常用分布函数
均匀分布:runif()
正态分布:rnorm()
二项式分布:rbinom()
gamma分布:rgamma()
泊松分布:rpois()
指数分布:rexp()
几何分布:rgeom()