View source: R/modelling_context.R
| complete_modelling_context | R Documentation |
Adds a new regressor variable to an existing modelling context, either creating a new group or adding to an existing group.
complete_modelling_context(
modelling_context,
y,
group = "r",
name = "",
overwrite = FALSE
)
modelling_context |
A modelling context object created by
|
y |
A regressor. An object to format ( |
group |
Character. Name of the group to which the variable should be added. By default, the group is "r". |
name |
Character. Name to assign to the new regressor variable. |
overwrite |
a Boolean to indicate whether a variable already present should be replaced |
If a variable with the same name already exists in the group and overwrite
is FALSE, returns the original modelling context with a message.
The updated modelling context with the new variable added.
# Assuming we have a modelling context and a new regressor
my_context <- modelling_context()
# Add the new regressor to the context
my_context <- complete_modelling_context(
modelling_context = my_context,
y = AirPassengers,
group = "my_group",
name = "my_regressor"
)
# Add another regressor to the same group with same name
my_context <- complete_modelling_context(
modelling_context = my_context,
y = AirPassengers,
group = "my_group",
name = "my_regressor"
)
# Add another regressor to the same group
my_context <- complete_modelling_context(
modelling_context = my_context,
y = ABS,
group = "my_group",
name = "another_regressor"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.