我想知道如何在 R 中创建数字零长度向量?
最佳答案
如果您阅读了向量
(或数字
或逻辑
或字符
或整数的帮助
或 double
、'raw' 或 complex
等),那么你会看到它们都有一个 length
(或 length.out
参数默认为 0
因此
numeric()
logical()
character()
integer()
double()
raw()
complex()
vector('numeric')
vector('character')
vector('integer')
vector('double')
vector('raw')
vector('complex')
所有返回适当原子模式的 0 长度向量。
# the following will also return objects with length 0
list()
expression()
vector('list')
vector('expression')
关于r - 如何在 R 中创建零长度的数值向量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12614953/