knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
countess
: Helpers for dplyr
's count()
FunctionConvenience functions built on top of dplyr to count the number of instances of each value in columns of data frames.
count_all()
is group_by_all()
plus tally()
. count_at()
is group_by_at()
plus tally()
. count_if()
is group_by_if()
plus tally()
. You can install this development version of countess using
# install.packages("remotes") remotes::install_github("richierocks/countess")
This is a basic example which shows you how to solve a common problem:
suppressPackageStartupMessages(library(dplyr)) set.seed(19790801)
library(dplyr) library(countess) n <- 100 quarks <- data_frame( first_gen = sample(c("up", "down"), n, replace = TRUE), second_gen = sample(c("charm", "strange"), n, replace = TRUE), third_gen = factor(sample(c("top", "bottom"), n, replace = TRUE)) ) quarks %>% count_all() quarks %>% count_at(vars(contains("ir"))) quarks %>% count_if(is.factor)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.