> x=c(1,3,4,2,5,6,3,2)
> x
[1] 1 3 4 2 5 6 3 2
> mode(x)
[1] "numeric"
> y=c('a','b','c')
> y
[1] "a" "b" "c"
> mode(y)
[1] "character"
> mean(x) 平均
[1] 3.25
> sum(x)
[1] 26
> max(x)
[1] 6
> min(x)
[1] 1
> var(x) 方差
[1] 2.785714
> prod(x) 连乘
[1] 4320
> sd(x) 标准差
[1] 1.669046
> which.max(a)
Error in which.max(a) : object 'a' not found
> which.max(x)
[1] 6
> which.max(x)
[1] 6
> a=matrix(1:12,nrow=3,ncol=4)
> a
[,1] [,2] [,3] [,4]
[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12
> 2*a
[,1] [,2] [,3] [,4]
[1,] 2 8 14 20
[2,] 4 10 16 22
[3,] 6 12 18 24
> t(a)
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9
[4,] 10 11 12
> diag(4)
[,1] [,2] [,3] [,4]
[1,] 1 0 0 0
[2,] 0 1 0 0
[3,] 0 0 1 0
[4,] 0 0 0 1