| tf_gather | R Documentation |
tfd-objectSimilar in spirit to tidyr::gather(), but does NOT put the values in the
gathered columns into one very long "value"-column while labeling the different
original columns in a very long "key"-column – instead it creates a tfd-column
containing the functional measurements of the columns given in ....
tf_gather(
data,
...,
key = ".tfd",
arg = NULL,
domain = NULL,
evaluator = tf_approx_linear
)
data |
a data frame – note that |
... |
A selection of columns to collect as a |
key |
the name of the created |
arg |
optional. Argument values for the functions. If not provided, will be guessed from the column names as well.
See also |
domain |
optional. Range of possible |
evaluator |
optional. A function accepting arguments x, arg, evaluations. See |
a modified data.frame with a tfd column replacing the ....
dplyr::select()
Other tidyfun data wrangling functions:
tf_evaluate.data.frame(),
tf_nest(),
tf_spread(),
tf_unnest()
d <- tf_spread(growth[1:5, ]) |> dplyr::mutate(id = 1:dplyr::n())
dplyr::glimpse(d)
# tidyselect syntax for column selection:
tf_gather(d, starts_with("height"))
tf_gather(d, height_1:height_18)
tf_gather(d, -gender, -id)
# custom key name and arg values:
tf_gather(d, starts_with("height"), key = "height")
tf_gather(d, starts_with("height"), arg = seq(0, 1, length.out = 31))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.