R Package that facilitates various aspects of R package authorship and deployment in tandem with the usethis, devtools, and sinew packages. Features include:
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("meerapatelmd/easyBakeOven")
If you have the following functions:
love <-
function(thing_i_love) {
sprintf("I love %s.", thing_i_love)
}
like <-
function(thing_i_like) {
sprintf("I like %s.", thing_i_like)
}
You want to print what you love or what you like. For example, if you love apples:
love("apples")
#> [1] "I love apples."
If you like bananas:
like("bananas")
#> [1] "I like bananas."
What if I want to author a new function that prints both things I love
and things I like
in a single function call?
I can use easyBakeOven
’s make_args
functions to return arguments and their values for love()
and like()
to copy-and-paste into the new function.
The default and internal arguments from love()
are:
make_args(love)
#> thing_i_love
#>
#> thing_i_love = thing_i_love
The same for like()
are:
make_args(like)
#> thing_i_like
#>
#> thing_i_like = thing_i_like
I can then copy-and-paste the results from the above calls to make_args
to author like_and_love()
. Starting with the default values for the arguments for
both functions, both of which are missing.
like_and_love <-
# Added default arguments
function(thing_i_love,
thing_i_like) {
}
The internal arguments can then be copy-and-pasted.
like_and_love <-
function(thing_i_love,
thing_i_like) {
sprintf("%s AND %s",
# Added internal arguments
love(thing_i_love = thing_i_love),
like(thing_i_like = thing_i_like))
}
The function is now authored and executable.
like_and_love(thing_i_love = "apples",
thing_i_like = "bananas")
#> [1] "I love apples. AND I like bananas."
Please note that the suzyBakeOven project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.