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

orderlabel

Overview

orderlabel is the second package in the Y2 Analytics series. Many of its functions rely heavily on the frequencies data frame created by the freqs() function from the y2clerk package. The premier function in this package is order_label(), but we will quickly go over a few of the other major functions as well.

Installation

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

install.packages("orderlabel")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("nick-moffitt/orderlabel")

Examples

Below you will find a few basic examples which show you how to quickly order your frequencies table with order_label():

library(orderlabel)
library(dplyr)
# Ungrouped, put in descending order of the result
frequencies <- tibble(
  label = c('Brand 1', 'Brand 2', 'Brand 3', 'Brand 4', 'Brand 5'),
  result = c(.25, .15, .20, .10, .30),
  value = c(1, 2, 3, 4, 5)
) %>% order_label()

# # Grouped, with an inherent order for the label, or the brand
# frequencies <- tibble(
#   label = rep(c('Brand 1', 'Brand 2', 'Brand 3', 'Brand 4', 'Brand 5'), 2),
#   result = c(.20, .20, .30, .10, .20, .20, .30, .20, .20, .10),
#   value = rep(c(1, 2, 3, 4, 5), 2),
#   group_var = c(rep('Group A', 5), rep('Group B', 5))
# ) %>% order_label(
#   group_var = group_var,
#   inherent_order_label = T
# )
# 
# # Stacked, will be using this frequencies in an mschart later on
# frequencies <- tibble(
#   label = rep(c('Promoter', 'Passive', 'Detractor'), 3),
#   result = c(.33, .33, .34, .20, .30, .50, .25, .50, .25),
#   value = rep(c(1, 2, 3), 3),
#   group_var = c(rep('Group A', 3), rep('Group B', 3), rep('Group C', 3))
# ) %>% order_label(
#   group_var = group_var,
#   stacked = 'ms'
# )

Help

If you have issues using orderlabel, 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 orderlabel.



nick-moffitt/orderlabel documentation built on Nov. 9, 2023, 6:39 p.m.