Summarize sales and customers by year

summary_sale(x, include_revenue = FALSE, rnd = 1, out = NULL,
  title = "Summarize Sales & Customers", note = NULL,
  suppress_notes = FALSE)

Arguments

x

data frame: Table holding sales by year with a minimum of 2 variables (cust_id, year)

include_revenue

logical: If TRUE, revenue by year will also be shown

rnd

numeric: number of decimals to round pct change results

out

character: file path to optional output csv

title

character: title for output table

note

character: note for output table

suppress_notes

logical: If TRUE, returns a data frame only

See also

Other functions for validating license data: check_dups, count_lines_textfile, summary_churn, summary_initial

Examples

library(dplyr) data(sale) summary_sale(sale)
#> Summarize Sales & Customers: #> (https://wsfrprograms.fws.gov/Subpages/LicenseInfo/LicenseIndex.htm) #> -------------------------------------------------------------------- #> year change_cust customers change_sales sales #> 2008 NA% 6393 NA% 10,823 #> 2009 16.2% 7428 18.8% 12,860 #> 2010 0.6% 7475 2.6% 13,189 #> 2011 -2.3% 7306 -4.6% 12,582 #> 2012 1.9% 7447 -1.7% 12,364 #> 2013 -2.7% 7245 17.9% 14,575 #> 2014 7.1% 7757 -1.4% 14,368 #> 2015 -1.3% 7660 0.3% 14,408 #> 2016 -1.2% 7568 -2.4% 14,066 #> 2017 1.4% 7673 7.6% 15,128 #> 2018 -5.1% 7281 -5.2% 14,343
# example with made-up license revenue sale2 <- mutate(sale, revenue = 30) summary_sale(sale2, rnd = 2, include_revenue = TRUE)
#> Summarize Sales & Customers: #> (https://wsfrprograms.fws.gov/Subpages/LicenseInfo/LicenseIndex.htm) #> -------------------------------------------------------------------- #> year change_cust customers change_sales sales change_revenue revenue #> 2008 NA% 6393 NA% 10,823 NA% 324,690 #> 2009 16.19% 7428 18.82% 12,860 18.82% 385,800 #> 2010 0.63% 7475 2.56% 13,189 2.56% 395,670 #> 2011 -2.26% 7306 -4.60% 12,582 -4.60% 377,460 #> 2012 1.93% 7447 -1.73% 12,364 -1.73% 370,920 #> 2013 -2.71% 7245 17.88% 14,575 17.88% 437,250 #> 2014 7.07% 7757 -1.42% 14,368 -1.42% 431,040 #> 2015 -1.25% 7660 0.28% 14,408 0.28% 432,240 #> 2016 -1.20% 7568 -2.37% 14,066 -2.37% 421,980 #> 2017 1.39% 7673 7.55% 15,128 7.55% 453,840 #> 2018 -5.11% 7281 -5.19% 14,343 -5.19% 430,290