ragged | R Documentation |
Small utilities for ragged objects. Modify the elements of raggedCoef objects, extract them as a vector.
rag_modify(rag, v)
ragged2vec(x)
rag |
the |
v |
vector of values to replace the old ones. |
x |
a |
An error will occur if the length of v
is not equal to
sum(rag@p)
.
rag_modify
is, in a sense, the inverse of ragged2vec
.
for rag_modify
, a raggedCoef
object of the same order as
rag
but with coefficients replaced by the new values.
for ragged2vec
, a numeric vector.
rag1 <- new("raggedCoef", list(1, 2:3, 4:6))
a1 <- (1:6)^2
rag1a <- rag_modify(rag1, a1)
rag2 <- new("raggedCoef", list(1, numeric(0), 4:6)) # a zero-length ccomponent
a2 <- (1:4)^2
rag2a <- rag_modify(rag2, a2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.