Created
December 17, 2012 17:42
-
-
Save anonymous/4320253 to your computer and use it in GitHub Desktop.
R code to generate a graph of probability I will work from home as a function of number of people in the office
This file contains hidden or 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(ggplot) | |
decay <- function (x, lambda = 5) { | |
return((100 * exp((-1 * lambda) * x))) | |
} | |
xs <- seq(from = 1, to = 10, by = 0.001) | |
ys <- sapply(xs, decay, lambda = 0.4) | |
xticks <- 1:10 | |
yticks <- seq(from = 0, to = 100, by = 10) | |
png("~/Downloads/probability-of-wfh.png", width=1800, height=1600) | |
ggplot(data = NULL, aes(x = xs, y = ys)) + geom_path() + | |
labs(title = "Probability Ryan Will WFH", x = "Number of people in office", | |
y = "Probability of WFH") + | |
scale_x_continuous(breaks = xticks, labels = xticks) + | |
scale_y_continuous(breaks = yticks, labels = yticks) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment