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

y2clerk

Overview

y2clerk exists to quickly create formatted frequencies tables. It leverages the tidyverse, allowing the user to %>% in data frames, select() down to lists of variables, group_by() others, and include weights for the frequencies. There are two main functions in y2clerk:

Installation

You can install the most updated package version from GitHub with:

# install.packages("devtools")
devtools::install_github("y2analytics/y2clerk")

Examples

Below you will find a few basic examples which show you how to quickly get a frequencies table with freqs():

library(y2clerk)
library(dplyr)
df <- data.frame(
  a = c(1, 2, 2, 3, 4, 2, NA),
  b = c(1, 2, 2, 3, 4, 1, NA),
  weights = c(0.9, 0.9, 1.1, 1.1, 1, 1, 1)
)

freqs(df, a, b)
df %>% freqs(a, b, wt = weights)
freqs(df, stat = 'mean', nas = FALSE)
freqs(df, stat = 'mean', nas = FALSE, wt = weights)
df %>% group_by(a) %>% freqs(b, stat = 'mean', nas = FALSE, wt = weights)

Help

If you have issues using y2clerk, please post your issue on GitHub along with a minimal reproducible example. We will do our best to address your issues and get them fixed for the next version of y2clerk.



y2analytics/y2clerk documentation built on March 26, 2024, 2:10 a.m.