Replaces a continuous variable x
in the data frame, and
possibly another continuous variable x_ns
derived from it, with new
values, for each level of a grouping factor (usually id)
new_x(data, x_values, group_by = "id", x = "age", x_ns = NULL)
A data frame. Can also be an lgpfit or lgpmodel object, in which case data is extracted from it.
the values of x
to set for each individual
name of the grouping variable, must be a factor
in data
(or use group_by=NA
to create a dummy grouping
factor which has only one value)
of the variable along which to extend,
must be a numeric in data
of a nonstationary variable derived from x
,
must be a numeric in data
a data frame containing the following columns
all factors in the original data
x
x_ns
(unless it is NULL)
Other data frame handling functions:
add_dis_age()
,
add_factor()
,
add_factor_crossing()
,
adjusted_c_hat()
,
split()