File: add_intercept_column.Rd

package info (click to toggle)
r-cran-hardhat 1.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,656 kB
  • sloc: sh: 13; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 851 bytes parent folder | download
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/intercept.R
\name{add_intercept_column}
\alias{add_intercept_column}
\title{Add an intercept column to \code{data}}
\usage{
add_intercept_column(data, name = "(Intercept)")
}
\arguments{
\item{data}{A data frame or matrix.}

\item{name}{The name for the intercept column. Defaults to \code{"(Intercept)"},
which is the same name that \code{\link[stats:lm]{stats::lm()}} uses.}
}
\value{
\code{data} with an intercept column.
}
\description{
This function adds an integer column of \code{1}'s to \code{data}.
}
\details{
If a column named \code{name} already exists in \code{data}, then \code{data} is returned
unchanged and a warning is issued.
}
\examples{
add_intercept_column(mtcars)

add_intercept_column(mtcars, "intercept")

add_intercept_column(as.matrix(mtcars))
}