get_dim | R Documentation |
Subset matrix dropping dimension but without dropping dimname
(as done by `[`
by default).
get_col(matrix, rows, col)
get_row(matrix, row, cols)
matrix |
matrix. |
rows |
numeric; rows to subset; like with |
col |
integer; single column to subset. |
row |
integer; single row to subset. |
cols |
numeric; columns to subset; like with |
A named vector
object.
Carles \Breto
m <- matrix(NA,dimnames=list('r1','c1'))
m[1,1] # = NA; R removes both names
get_col(m,rows=1,col=1) # = c(r1=NA) keeps colname
get_row(m,row=1,cols=1) # = c(c1=NA) keeps rowname
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.