| generate_x | R Documentation |
Helper function to generate a sequence of new values for each species,
based on the range of values for the predictor variable in the data.
Upward and downward extrapolation to specified values can be made.
Predictions can subsequently be made on the generated values.
generate_x( data, response = "height", predictor = "diameter", species = "species", extrapolate = NULL, length.out = 100 )
data |
Dataframe that contains the variables of interest. Each row is a measurement for an individual tree of a particular species. |
response |
Column name of the response variable in |
predictor |
Column name of the predictor variable in |
species |
Column name of the species variable in |
extrapolate |
Numeric vector of 2 elements (e.g. |
length.out |
Number of new values to generate for each species. Defaults to 100. Set a higher value for greater resolution at the cost of computational time. |
A dataframe with columns:
Name of tree species.
Newly generated predictor values.
Indicates whether the predictor (x) values are extrapolated beyond the supplied dataset. Either 'High', 'Low', or 'No' (not extrapolated).
newdata <- generate_x(urbantrees,
extrapolate = c(0,4),
response = "height", predictor = "diameter")
head(newdata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.