Add an intercept column to data
This function adds an integer column of 1
's to data
.
add_intercept_column(data, name = "(Intercept)")
data |
A data frame or matrix. |
name |
The name for the intercept column. Defaults to |
If a column named name
already exists in data
, then data
is returned
unchanged and a warning is issued.
data
with an intercept column.
add_intercept_column(mtcars) add_intercept_column(mtcars, "intercept") add_intercept_column(as.matrix(mtcars))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.