[Rd] Testing for vectors
Rui Barradas
ruipb@rr@d@@ @ending from @@po@pt
Sat Jul 7 22:47:40 CEST 2018
Hello,
Inline.
Às 21:32 de 07-07-2018, Hadley Wickham escreveu:
> On Sat, Jul 7, 2018 at 1:50 PM, Gabe Becker <becker.gabe using gene.com> wrote:
>> Hadley,
>>
>>>
>>> I was thinking primarily of completing the set of is.matrix() and
>>> is.array(), or generally, how do you say: is `x` a 1d dimensional
>>> thing?
>>
>>
>> Can you clarify what you mean by dimensionality sense and specifically 1d
>> here?
>
> What do we call a vector that is not an array? (or matrix)
>
> What do we call an object that acts 1-dimensional? (i.e. has
> length(dim()) %in% c(0, 1)) ?
>
>> You can also have an n x 1 matrix, which technically has 2 dimensions but
>> conceptually is equivalent to a 1d array and/or a vector.
>
> Yes. You can also have array that's n x 1 x 1.
In which case it would be
(length(dim(.)) - sum(dim(.) == 1)) %in% c(0, 1)
Hope this helps,
Rui Barradas
>
>> Also, are you including lists in your conceptions of 1d vector here? I'm
>> with Duncan here, in that i'm having trouble understanding exactly what you
>> want to do without a bit more context.
>
> Isn't it standard terminology that a vector is the set of atomic vectors + list?
>
> Hadley
>
More information about the R-devel
mailing list