[Rd] Testing for vectors

Hadley Wickham h@wickh@m @ending from gm@il@com
Sat Jul 7 19:20:29 CEST 2018


Hi all,

Is there are base function that I've missed that tests if an object is
a vector in the dimensionality sense, rather than the data structure
sense? i.e. something that checks is.null(dim(x)) ?

is.vector() is trivially disqualified since it also checks for the
presence of non-names attributes:

x <- factor(c("a", "a", "b"))
is.vector(x)
#> [1] FALSE

is.null(dim(x))
#> [1] TRUE

Hadley

-- 
http://hadley.nz



More information about the R-devel mailing list