Created
December 7, 2017 18:36
-
-
Save DarwinAwardWinner/594e89e1210e02c0be25c451609b8577 to your computer and use it in GitHub Desktop.
code to compare the new and old Patreon fee structures described here: https://blog.patreon.com/updating-patreons-fee-structure/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(magrittr) | |
library(dplyr) | |
library(ggplot2) | |
library(purrr) | |
library(forcats) | |
library(glue) | |
pledge.amount <- 1 | |
x <- list( | |
Old_WorstCase=c( | |
Service_Fee = 0.1 * pledge.amount, | |
Patreon_Fee = pledge.amount * 0.05, | |
Creator_Take_Home = 0.85 * pledge.amount), | |
Old_BestCase=c( | |
Service_Fee = 0.02 * pledge.amount, | |
Patreon_Fee = pledge.amount * 0.05, | |
Creator_Take_Home = 0.93 * pledge.amount), | |
New_Fees=c( | |
Service_Fee = pledge.amount * 0.029 + 0.35, | |
Patreon_Fee = pledge.amount * 0.05, | |
Creator_Take_Home = pledge.amount * 0.95)) | |
feetable <- lapply( | |
x, . %>% | |
tibble(Destination=names(.), Amount=.) %>% | |
mutate(Percent = Amount / sum(Amount) * 100)) %>% | |
map_df(bind_rows, .id = "Fee_Structure") %>% | |
mutate(Fee_Structure = fct_inorder(Fee_Structure), | |
Destination = fct_inorder(Destination)) | |
p <- ggplot(feetable) + | |
aes(x=Fee_Structure, y=Amount, fill=Destination) + | |
geom_col() | |
print(p + ggtitle(glue("Total amounts for a pledge of ${pledge.amount}"))) | |
print(p + aes(y=Percent) + ggtitle(glue("Percent of total pledge for a pledge of ${pledge.amount}"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment