# #数据获取
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 represents the average by column
Apply (x, 2, mean)
Apply (x, 2, Max)
Apply (x, 2, min)
Apply (X[c ("x1", "X2", "x3")], 2, sum)
#常用分布函数
Uniform distribution: runif ()
Normal distribution: Rnorm ()
Two-Item Distribution: Rbinom ()
Gamma distribution: Rgamma ()
Poisson distribution: Rpois ()
Index distribution: Rexp ()
Geometric distribution: Rgeom ()
> Which.max (Apply (X[c ("x1", "X2", "x3")], 1, sum) 49
> X$num[which.max (Apply (X[c ("x1", "X2", "x3")], 1, sum)] [1] 2005138149
> hist (x$x1)
> Plot (X$X1,X$X2)
> table (X$X1)
80 81 82 83 84 85 86 87 88 89 90 91 92 93 95 96 97 98 99 100 2 3 4 3 8 3 6 6 6 7 4 6 4 8 8 3 5 6) 6 2
> Barplot (Table (X$X1))
> Pie (Table (X$X2))
> BoxPlot (x$x1, x$x2, x$x3)
> BoxPlot (X[2:4], col=c ("Red", "Blue", "green"), notch=t)
> Stars (X[c ("x1", "X2", "x3")])
> Stars (X[c ("x1", "X2", "x3")],full=t, Draw.segment=t)
> Faces (x[c ("x1", "X2", "x3")])
> Stem (x$x1)
The decimal point was at the |
80 | 00000 82 | 0000000 84 | 00000000000 86 | 000000000000 88 | 0000000000000 90 | 0000000000 92 | 000000000000 94 | 00000000 96 | 00000000 98 | 000000000000 100 | 00
> Stem (x$x2, scale = 1, width = +, Atom = 1e-08)
The decimal point was 1 digit (s) to the right of the |
6 | 23 6 | 7788889 7 | 00001222333444444 7 | 55666677777788888999 8 | 0000000000111122233333344444 8 | 5566666677778999 9 | 001112234 9 | 5
> Stem (x$x3, scale = 1, width = +, Atom = 1e-08)
The decimal point was 1 digit (s) to the right of the |
3 | 9 4 | 5 | 0022346788 6 | 1112233344555667789 7 | 022223344444555667889 8 | 0122333444455677999 9 | 000112223345666777889 10 | 000000000
> Qqnorm (x1) > Qqline (x1)
> Qqnorm (x2)
> Qqline (x2)
R language Visualization