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

R-CMD-check

heir

Healthy Eating Index (HEI) scoring is not the simplest of calculations. But this package simply does it! Function hei() will compute HEI-2015 total and component scores using data from 'ASA24' (2016 version and subsequent versions). It implements the 'simple HEI scoring algorithm' as described at https://epi.grants.cancer.gov/hei/hei-methods-and-calculations.html. The 'ASA24' system is described at https://epi.grants.cancer.gov/asa24. HEI-2015 is described by Krebs-Smith et al. (2018) .

Installation

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

install.packages("heir")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("AdamSadowski/heir")

Quick demo

Adding HEI columns to the end of a data frame via hei():

1) Example data:

library(heir)

asa.df <- read.csv("./tests/testthat/asa_example_df.csv")

asa.df

2) hei() creates HEI variables for each row. It accepts a data frame and returns it with these added variables.

df <- hei(asa.df)

# grep just to show X and HEI variables

df[, grep("X|HEI", names(df))]


AdamSadowski/heir documentation built on April 14, 2025, 6:19 a.m.