1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/form_pred.R
\name{form_pred}
\alias{form_pred}
\title{Extract Predictor Names from Formula or Terms}
\usage{
form_pred(object, ...)
}
\arguments{
\item{object}{A model formula or \code{\link[stats:terms]{stats::terms()}}
object.}
\item{...}{Arguments to pass to \code{\link[=all.vars]{all.vars()}}}
}
\value{
A character vector of names
}
\description{
\code{all.vars} returns all variables used in a formula. This
function only returns the variables explicitly used on the
right-hand side (i.e., it will not resolve dots unless the
object is terms with a data set specified).
}
\examples{
form_pred(y ~ x + z)
form_pred(terms(y ~ x + z))
form_pred(y ~ x + log(z))
form_pred(log(y) ~ x + z)
form_pred(y1 + y2 ~ x + z)
form_pred(log(y1) + y2 ~ x + z)
# will fail:
# form_pred(y ~ .)
form_pred(terms(mpg ~ (.)^2, data = mtcars))
form_pred(terms(~ (.)^2, data = mtcars))
}
|