linear_regression: Compute linear regression on data using formula and make it...

Description Usage Arguments Value Examples

View source: R/regression.R

Description

Compute linear regression on data using formula and make it work with magrittr pipe operator.

Usage

1

Arguments

data

A dataframe, e.g. mtcars.

formula

A formula, e.g. mpg ~ wt.

Value

A modified dataframe containing the variables in the equation plus the fitted value and the residuals. The formula, model coefficients, variable correlation matrix and overall R^2 and AdjR^2 are attached to the dataframe as attributes.

Examples

1
2
3
4
5
library(datasets)
library(dplyr)
library(regressR)
result <- linear_regression(mtcars, mpg ~ wt)
result2 <- mtcars %>% linear_regression(mpg ~ wt)

sciprojguy/regressR documentation built on Nov. 20, 2019, 12:05 a.m.