From @eliv@nov@dmitriy @ending from gm@il@com  Wed Nov 21 17:51:54 2018
From: @eliv@nov@dmitriy @ending from gm@il@com (Dmitriy Selivanov)
Date: Wed, 21 Nov 2018 20:51:54 +0400
Subject: [Rd] Subsetting row in single column matrix drops names in
 resulting vector
Message-ID: <CAJdZCv0qGoOG6a0V1uzg7tgDRQUjkzn4We=tkb_N1770nr+MHg@mail.gmail.com>

Hello here. I'm struggling to understand R's subsetting behavior in couple
of edge cases - subsetting row in a single column matrix and subsetting
column in a single row matrix. I've read R's docs several times and haven't
found answer.

Consider following example:

a = matrix(1:2, nrow = 2, dimnames = list(c("row1", "row2"), c("col1")))
a[1, ]
# 1

It returns *unnamed* vector `1` where I would expect named vector. In fact
it returns named vector when number of columns is > 1.
Same issue applicable to single row matrix. Is it a bug? looks very
counterintuitive.


-- 
Regards
Dmitriy Selivanov

	[[alternative HTML version deleted]]



[Rd] Subsetting row in single column matrix drops names in resulting vector
Dmitriy Selivanov