Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sam Tyner
committed
Apr 26, 2019
1 parent
d150271
commit 6dcd927
Showing
10 changed files
with
33 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
#' Add meme to `memer` package | ||
#' | ||
#' @param name Name of the meme in CamelCase. | ||
#' @param name Name of the meme in CamelCase. | ||
#' @param file Filename including the file extension. | ||
#' | ||
#' | ||
#' @keywords internal | ||
#' | ||
#' | ||
#' @details `memer` uses `memer::blankmemes` to resolve filenames, so to use a | ||
#' new meme you must build and install the package after running `meme_add()`. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' meme_add("YoDawg", "yodawg.png") | ||
#' memer::meme_add("YoDawg", "yodawg.png") | ||
#' } | ||
#' @export | ||
meme_add <- function(name, file) { | ||
|
||
|
||
if (name %in% memer::blankmemes$name) { | ||
stop(paste0("Error: The ", name, " meme is already present in memer::blankmemes")) | ||
} | ||
|
||
cat('Make sure you have added the image file to the inst/extdata directory') | ||
|
||
blankmemes <- dplyr::add_row(blankmemes, filename = file, name = name) %>% | ||
dplyr::arrange(filename) | ||
|
||
|
||
blankmemes <- memer::blankmemes %>% | ||
dplyr::add_row(filename = file, name = name) %>% | ||
dplyr::arrange(filename) %>% | ||
dplyr::distinct() # make sure there aren't duplicates | ||
|
||
usethis::use_data(blankmemes, overwrite = T) | ||
} | ||
|
||
} |
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
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
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
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.