Learn R Programming

mrgsolve (version 0.8.12)

as_bmat: Coerce R objects to block or diagonal matrices

Description

Coerce R objects to block or diagonal matrices

Usage

as_bmat(x, ...)

# S4 method for list as_bmat(x, ...)

# S4 method for numeric as_bmat(x, pat = "*", ...)

# S4 method for data.frame as_bmat(x, pat = "*", cols = NULL, ...)

# S4 method for ANY as_bmat(x, ...)

as_dmat(x, ...)

# S4 method for list as_dmat(x, ...)

# S4 method for ANY as_dmat(x, ...)

# S4 method for numeric as_dmat(x, pat = "*", ...)

# S4 method for data.frame as_dmat(x, pat = "*", cols = NULL, ...)

Arguments

x

an R object

...

passed along

pat

regular expression, character

cols

column names to use instead of pat

Value

A numeric matrix for list and numeric methods. For data.frames, a list of matrices are returned.

See Also

bmat, dmat

Examples

Run this code
# NOT RUN {
df <- data.frame(OMEGA1.1 = c(1,2),
                 OMEGA2.1 = c(11,22),
                 OMEGA2.2 = c(3,4),
                 SIGMA1.1 = 1,
                 FOO=-1)

as_bmat(df, "OMEGA")
as_dmat(df,"SIGMA")
as_dmat(df[1,],"OMEGA")

# }

Run the code above in your browser using DataLab