knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

ezlm

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

The goal of ezlm is to fit a simple linear regression model, outputting easy-to-read results rounded to user's preferred decimal place. A wrapper for lm().

Installation

The ezlm package is not yet available from CRAN. Please download it from this repository using the following R command:

devtools::install_github("deansn/ezlm")

Example

Fuel Economy and Horsepower inmtcars

As a basic demonstration of the ezlm() function, begin by calling the function and inputting the appropriate variables (as described in the documentation above).

Let's say we're interested in the effect of fuel economy on horsepower, and we want to see our results to three decimal places:

library(ezlm)
ezlm(mtcars, mtcars$mpg, mtcars$hp, 3)

Urban Population and Assaults in USArrests

While this function was designed primarily for linear regressions within the mtcars dataset, it should work with other datasets, such as USArrests. In this example, let's look at the influence of the urban population proportion on the number of assault charges.

ezlm(USArrests, USArrests$UrbanPop, USArrests$Assault, 2)

Inappropriate Inputs

To force my function to throw one of my custom error messages, we can try to replace one of the numerical parameters with a non-accepted input class:

ezlm(mtcars, as.factor(mtcars$mpg), mtcars$hp, 3)

As expected, the function throws the custom error message when the IV is defined as a factor variable.



deansn/ezlm documentation built on Dec. 19, 2021, 10:06 p.m.