tf_jiggle: Make a 'tf' (more) irregular

View source: R/rng.R

tf_jiggleR Documentation

Make a tf (more) irregular

Description

Randomly create some irregular functional data from regular ones.

  • jiggle it by randomly moving around its arg-values inside the intervals defined by its grid neighbors on the original argument grid.

  • sparsify it by removing (100*dropout)% of the function values

Usage

tf_jiggle(f, amount = 0.4, ...)

tf_sparsify(f, dropout = 0.5)

Arguments

f

a tfd object.

amount

how far away from original grid points can the jiggled grid points lie, at most (relative to original distance to neighboring grid points). Defaults to at most 40% (0.4) of the original grid distances. Must be lower than 0.5.

...

additional args for the returned tfd in tf_jiggle.

dropout

what proportion of values of f to drop, on average. Defaults to half.

Value

an (irregular) tfd object.

See Also

Other tidyfun RNG functions: tf_rgp()

Examples

set.seed(1)
(x <- tf_rgp(2, arg = 21L))
(x_jig <- tf_jiggle(x, amount = 0.2))
(x_sp <- tf_sparsify(x, dropout = 0.3))
c(is_irreg(x_jig), is_irreg(x_sp))

tf documentation built on April 7, 2026, 5:07 p.m.