as_procmod_frame: Coerce to a ProcMod Frame.

Description Usage Arguments Value Author(s) Examples

View source: R/procmod_frame.R

Description

Conversion methods are proposed for list, matrix and array.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
as_procmod_frame(data, ...)

## S3 method for class 'list'
as_procmod_frame(data, ...)

## S3 method for class 'procmod_frame'
as_procmod_frame(data, ...)

## S3 method for class 'array'
as_procmod_frame(data, ...)

## S3 method for class 'matrix'
as_procmod_frame(data, ...)

Arguments

data

a R object to coerce.

...

supplementary parameters used in some implementation of that method

Value

a procmod_frame object

Author(s)

Eric Coissac

Christelle Gonindard-Melodelima

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Builds a list containing two random matrices
m1 <- simulate_matrix(10,20)
m2 <- simulate_matrix(10,30)
l <- list(m1 = m1, m2 = m2)

# Converts the list to a procmod_frame
pmf1 <- as_procmod_frame(l)

# Builds a procmod_frame from a matrix
m3 <- matrix(1:12,nrow=3)
pmf2 <- as_procmod_frame(matrix(1:12,nrow=3))
# Returns 4, the column count of the input matrix
length(pmf2)

# Builds a 3D array
a <- array(1:24,dim = c(3,4,2))

# The conversion to a procmod_frame makes
# an procmod element from each third dimension
as_procmod_frame(a)

ProcMod documentation built on May 12, 2021, 9:08 a.m.