| tf_split | R Documentation |
tf_split separates each function into a vector of functions defined on a sub-interval of
its domain, either with overlap at the cut points or without.
tf_combine joins functional fragments together to create longer (or more densely evaluated) functions.
tf_split(x, splits, include = c("both", "left", "right"))
tf_combine(..., strict = FALSE)
x |
a |
splits |
numeric vector containing |
include |
which of the end points defined by |
... |
|
strict |
only combine functions whose argument ranges do not overlap,
are given in the correct order & contain no duplicate values at identical arguments?
defaults to |
for tf_split: a list of tf objects.
for tf_combine: a tfd with the combined subfunctions on the union of the input tf_arg-values
x <- tfd(1:100, arg = 1:100)
tf_split(x, splits = c(20, 80))
tf_split(x, splits = c(20, 80), include = "left")
tf_split(x, splits = c(20, 80), include = "right")
x <- tf_rgp(5)
tfs <- tf_split(x, splits = c(.2, .6))
x2 <- tf_combine(tfs[[1]], tfs[[2]], tfs[[3]])
# tf_combine(tfs[[1]], tfs[[2]], tfs[[3]], strict = TRUE) # errors out - duplicate values!
all.equal(x, x2)
# combine works for different input types:
tfs2_sparse <- tf_sparsify(tfs[[2]])
tfs3_spline <- tfb(tfs[[3]])
tf_combine(tfs[[1]], tfs2_sparse, tfs3_spline)
# combine(.., strict = F) can be used to coalesce different measurements
# of the same process over different grids:
x1 <- tfd(x, arg = tf_arg(x)[seq(1, 51, by = 2)])
x2 <- tfd(x, arg = tf_arg(x)[seq(2, 50, by = 2)])
tf_combine(x2, x1, strict = FALSE) == x
plot(tf_combine(x2, x1, strict = FALSE))
points(x1, col = "blue", pch = "x")
points(x2, col = "red", pch = "o")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.