R 显示向量
有什么东西可以显示它吗 也许R 显示向量,r,R,有什么东西可以显示它吗 也许是.vector()?这将测试对象是否为向量: > a=c(1,2,3,4) > a [1] 1 2 3 4 > typeof(a) [1] "double" > mode(a) [1] "numeric" > attributes(a) NULL > str(a) num [1:4] 1 2 3 4 作为反例: is.vector(a) [1] TRUE g@DanielFi
是.vector()
?这将测试对象是否为向量:
> a=c(1,2,3,4)
> a
[1] 1 2 3 4
> typeof(a)
[1] "double"
> mode(a)
[1] "numeric"
> attributes(a)
NULL
> str(a)
num [1:4] 1 2 3 4
作为反例:
is.vector(a)
[1] TRUE
g@DanielFischer:owner重新标记了r
@yhyrcanus Nopestr()
是一个返回对象摘要的函数。更像是结构而不是摘要。我认为summary是为同名函数保留的。@PengPeng“生成一个显示向量”是什么意思?你能准确地键入你想看的内容吗?你想让它说“vector”吗?是的,我想让R说“vector”作为>g类(g)[1]“function”如果我不知道一个是向量,我怎么能使用is.vector()?@PengPengis.vector
测试一个对象是否是向量。请参阅我编辑的答案。
g <- function(x)x
is.vector(g)
[1] FALSE
class(g)
[1] "function"