new_data: Generate New Data *[Superseded]*

View source: R/new-data.R

new_dataR Documentation

Generate New Data [Superseded]

Description

Generates a new data frame (in the form of a tibble) with each variable held constant or varying as a unique ordered sequence.

Usage

new_data(
  data,
  seq = character(0),
  ref = list(),
  obs_only = list(character(0)),
  length_out = 30
)

Arguments

data

The data frame to generate the new data from.

seq

A character vector of the variables in data to generate sequences for.

ref

[Deprecated] A named list of reference values for variables that are not in seq. Deprecated for ⁠[xnew_value()]⁠ in ⁠[xnew_data()]⁠.

obs_only

[Deprecated] A list of character vectors indicating the sets of variables to only allow observed combinations for. If TRUE then obs_only is set to be seq. Deprecated for ⁠[xobs_only()]⁠ in ⁠[xnew_data()]⁠.

length_out

A count indicating the maximum length of sequences for all types of variables except logical, character, factor and ordered factors.

Details

Although superseded it is maintained for backwards compatibility with existing code.

The code new_data(data, seq = c("a", "b"), length_out = 30) is effectively a wrapper for xnew_data(data, a, b, .length_out = 30) to allow a string of column names to be passed.

Value

A tibble of the new data.

See Also

xnew_data().

Examples

new_data(old_data, "int")
new_data(old_data, "dbl")
new_data(old_data, c("int", "dbl"))

poissonconsulting/newdata documentation built on Feb. 6, 2025, 4:58 p.m.