p_lm: Fits linear models, with support for piping

View source: R/p_lm.r

p_lmR Documentation

Fits linear models, with support for piping

Description

A wrapper function for lm(), with the data argument listed first to support native piping.

Usage

p_lm(data, formula, ...)

Arguments

data

the data

formula

the formula

...

additional arguments passed to stats::lm().

Value

an lm object

Examples

# load the data
data(nhanes)

# define country
nhanes<-nhanes |> transform(
  country=base_match(dmdborn4,'USA'=1,'Other'=2)
)

# fit a model
my_model<-nhanes |> p_lm(bpxosy1~country)

# obtain model details
my_model |> summary()

# obtain confidence interval
my_model |> confint()

baseverse documentation built on April 29, 2026, 1:08 a.m.