See the help page for the "[" operator ...
?"["
... and use the drop parameter as in:
A[1,,drop=FALSE]
[,1] [,2] [,3] [,4]
a1147 10
B.
On Mar 21, 2015, at 8:10 AM, J Robertson-Burns
wrote:
> This is Circle 8.1.44 of 'The R Inferno'.
>
> http://www.burns-stat.com/documents
This is Circle 8.1.44 of 'The R Inferno'.
http://www.burns-stat.com/documents/books/the-r-inferno/
Pat
On 21/03/2015 11:04, jean.cour...@math.u-psud.fr wrote:
My question must be a trivial one.
There is automatic coercicion to vector when extracting only one line of a
matrix.
# example
A = ma
>From one Jean to another ... A[i, , drop=FALSE]
On Sat, Mar 21, 2015 at 6:04 AM, wrote:
> My question must be a trivial one.
>
> There is automatic coercicion to vector when extracting only one line of a
> matrix.
> # example
> A = matrix(1:12,3,4)
> rownames(A) = c('a1','a2','a3')
>
> i = 1:2
My question must be a trivial one.
There is automatic coercicion to vector when extracting only one line of a
matrix.
# example
A = matrix(1:12,3,4)
rownames(A) = c('a1','a2','a3')
i = 1:2
A[i,]
#[,1] [,2] [,3] [,4]
# a1147 10matrix
# a2258 11
i = 1
A[i,]
# [1
4 matches
Mail list logo