get_dim {panelPomp}R Documentation

Get single column or row without dropping names

Description

Subset matrix dropping dimension but without dropping dimname (as done by `[` by default).

Usage

get_col(matrix, rows, col)

get_row(matrix, row, cols)

Arguments

matrix

matrix.

rows

numeric; rows to subset; like with `[`, this argument can be left empty to designate all rows.

col

integer; single column to subset.

row

integer; single row to subset.

cols

numeric; columns to subset; like with `[`, this argument can be left empty to designate all columns.

Value

A named vector object.

Author(s)

Carles Bretó

Examples

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

[Package panelPomp version 1.4.0.1 Index]