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

hei

Travis build status

Healthy Eating Index (HEI) scoring is not the simplest of calculations. This package contains a function to compute HEI total and component scores from ASA 24-hour diet recall data.

Installation

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

install.packages("hei")

And the development version from GitHub with:

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

Quick demo

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

1) Example data:

library(hei)

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/hei documentation built on Dec. 17, 2021, 6:49 a.m.