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

lvmisc

R build status CRAN status Codecov test coverage

lvmisc is a package with miscellaneous R functions, including basic data computation/manipulation, easy plotting and tools for working with statistical models objects. You can learn more about the methods for working with models in vignette("working_with_models").

Installation

You can install the released version of lvmisc from CRAN with:

install.packages("lvmisc")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("verasls/lvmisc")

Getting started

Some of what you can do with lvmisc.

library(lvmisc)
library(dplyr)

# Compute body mass index (BMI) and categorize it
starwars %>%
  select(name, birth_year, mass, height) %>%
  mutate(
    BMI = bmi(mass, height / 100),
    BMI_category = bmi_cat(BMI)
  )

# Divide numerical variables in quantiles
divide_by_quantile(mtcars$wt, 4)

# Center and scale variables by group
center_variable(iris$Petal.Width, by = iris$Species, scale = TRUE)

# Quick and easy plotting with {ggplot}
plot_scatter(mtcars, disp, mpg, color = factor(cyl))

# Work with statistical model objects
m <- lm(disp ~ mpg + hp + cyl + mpg:cyl, mtcars)
accuracy(m)
plot_model(m)


verasls/lvmisc documentation built on Feb. 12, 2024, 8:21 a.m.