recoverdata | R Documentation |
Recover data from the data from the model
recoverdata(mod, extras = NULL, envir = environment(formula(mod)), ...)
mod |
fitted model |
envir |
data environment |
... |
for future implementations |
optional |
character vector or formula specifying the predictors. Important when the transformation are applied in the formula. |
It uses the fitted model and the global environment to reconstruct the data used in the model. If data
option is specified in the model formula, a dataframe with columns corresponding to the variable in the formula is returned. Any transformation, e.g. log
specified in the formula terms is not evaluated on the returned data frame. However, if no is provided, the dataframe is constructed from the formula terms with all transformations evaluated.
a dataframe
set.seed(4567)
x <- rnorm(100, 3, 5)
y <- 0.4 + 0.7*x + rnorm(100)
df <- data.frame(y = y, x = x)
m1 <- lm(y ~ x, df)
d1 <- recoverdata(m1)
head(d1)
m2 <- lm(y ~ x)
d2 <- recoverdata(m2)
head(d2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.