This function takes a formula and a data frame, and returns a design matrix based on the right-hand side of the formula. If the formula is `~.`, it treats all columns in the data as the design matrix. Otherwise, it constructs a design matrix without an intercept based on the specified formula.
Examples
data(mtcars)
# Extract a design matrix for 'mpg' and 'cyl'
X1 <- get_data_from_formula(~ mpg + cyl, mtcars)
#> Error in get_data_from_formula(~mpg + cyl, mtcars): could not find function "get_data_from_formula"
# Extract a design matrix for all columns
X2 <- get_data_from_formula(~., mtcars)
#> Error in get_data_from_formula(~., mtcars): could not find function "get_data_from_formula"
# Extract a design matrix for 'hp'
X3 <- get_data_from_formula(~hp, mtcars)
#> Error in get_data_from_formula(~hp, mtcars): could not find function "get_data_from_formula"
