R语言

> 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  



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值