From h@wickh@m @ending from gm@il@com  Sat Jul  7 19:20:29 2018
From: h@wickh@m @ending from gm@il@com (Hadley Wickham)
Date: Sat, 7 Jul 2018 12:20:29 -0500
Subject: [Rd] Testing for vectors
Message-ID: <CABdHhvF5gqJt3kDj-QuU92BWPiLWwGugxnNzOfHOHo9tp_AigA@mail.gmail.com>

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



[Rd] Testing for vectors
Hadley Wickham