R语言 求向量的模 如何操作呢?—R-China小编问题(35)
本帖最后由 editor 于 2013-5-25 11:27 编辑向量求模,是数学中常做的操作。
有人问R语言是否有函数直接可以求模。
经过小编搜索,果然有专门函数进行此类操作。
用户需要先在这包onion,安装后就可以操作了
下面介绍例子
## S3 method for class 'onion':
Norm(z)
## S3 method for class 'onion':
Mod(z)
## S3 method for class 'onion':
Mod(z) <- value
## S3 method for class 'onion':
sign(x)
Arguments
x,zOnionic vector
valueA real vector
Examples
a <- roct(5)
Norm(a)
Mod(a)
感兴趣的朋友可以参考
http://rss.acs.unt.edu/Rdoc/library/onion/html/Norm.html
直接sum(x*x)^0.5不就可以了么 sqrt(sum((a)^2)).......a为一向量 向量求模,是数学中常做的操作。
有人问R语言是否幸运飞艇走势图
有函数直接可以求模。
经过小编搜索,果然有专门函数进行此类双色球开奖结果 操作。
用户需要先在这包onion, 澳洲幸运20稳赚技巧 安装后就可以操作了
下面介绍例子
页:
[1]