Created
March 10, 2017 09:30
-
-
Save aammd/f566a3eafc6ee293d234b32812f3b2bb to your computer and use it in GitHub Desktop.
plotting with a function factory
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
rmax <- function(rm, baserate){ | |
force(rm) | |
force(baserate) | |
function(x) { | |
rm * x / ( | |
(rm / baserate) + x | |
) | |
} | |
} | |
library(dplyr) | |
library(ggplot2) | |
data_frame(x = 0:90, | |
y = 0, 1) %>% | |
ggplot(aes(x = x, y = y)) + | |
stat_function(fun = rmax(0.7, 0.3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment