RaggedArrayNew: Construct a new RaggedArray object

Description Usage Arguments Value See Also Examples

Description

RaggedArrayNew constructs a new RaggedArray object, filling it with the provided data, if any. Either dataList or nvec & allocLen are mandatory. Given one, the other(s) will be inferred. Alternately, if dataList is a serialized RaggedArray (e.g. is an R list with element SerializedRaggedArray), a new object will be created using the default List constructor. In this case, specs are silently ignored.

See RaggedArrayClass for methods to manipulate object.

Usage

1
2
RaggedArrayNew(dataList = NULL, nvec = NULL, allocLen = NULL,
  growBy = NULL)

Arguments

dataList

List of (numeric) vectors to fill the new object, or the results of a previous object$serialize().

nvec

Number of (column) vectors that object will store. This is constant over the lifespan of the object. Defaults to length(dataList).

allocLen

Number of rows to allocate in underlying data matrix. Object will grow as needed. Defaults to max(sapply(dataList, length)).

growBy

Number of rows to grow object data matrix by when reallocation is needed. Can be changed. Defaults to allocLen.

Value

An object of (S4) class RaggedArray.

See Also

Other Ragged.Array.Docs: RaggedArray-package

Examples

1
2
3
4
5
6
ragged <- RaggedArrayNew( list( 1:5, 1:6, 1:7))
all.equal(ragged, RaggedArrayNew( ragged$serialize() ))
ragged$sapply(function(x) x*2)
head(ragged$data)
sourceCpp(system.file('examples', 'cpp', 'userSapplyFun.cpp', package='RaggedArray'))
ragged$sapplyC(FunTimes10)

helmingstay/RaggedArray documentation built on May 17, 2019, 3:38 p.m.