标签:数据 ad app table sp 语言 基础 read
##数据获取
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)
标签:数据 ad app table sp 语言 基础 read
原文地址:http://www.cnblogs.com/takeaction/p/3903434.html