Skip to content

Commit

Permalink
update package
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Tyner committed Apr 26, 2019
1 parent d150271 commit 6dcd927
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 22 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Expand Up @@ -14,7 +14,9 @@ Imports:
readr,
stringr
Suggests:
rtweet
rtweet,
dplyr (>= 0.8.0),
usethis (>= 1.5.0)
License: GPL-2
Encoding: UTF-8
LazyData: true
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(meme_add)
export(meme_explain)
export(meme_get)
export(meme_list)
Expand Down
29 changes: 18 additions & 11 deletions R/add-meme.R
@@ -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)
}

}
3 changes: 2 additions & 1 deletion R/memer.R
Expand Up @@ -10,5 +10,6 @@
#' @name memer
NULL

## from https://github.com/STAT545-UBC/Discussion/issues/451:
## quiets concerns of R CMD check re: the .'s that appear in pipelines
if(getRversion() >= "2.15.1") utils::globalVariables(c("blankmemes"))
if(getRversion() >= "2.15.1") utils::globalVariables(c("blankmemes", "filename", "name"))
6 changes: 2 additions & 4 deletions cran-comments.md
Expand Up @@ -5,14 +5,12 @@

## R CMD check results

The warnings are inherited from the way the magick::image_annotate function is documented.

0 errors | 0 warnings | 1 note

NOTE:
installed size is 9.1Mb
installed size is 9.0Mb
sub-directories of 1Mb or more:
extdata 8.9Mb
extdata 8.8Mb

The extdata folder contains all of the meme images. Unfortunately, the large size of the folder is unavoidable because of this.

Expand Down
4 changes: 2 additions & 2 deletions data-raw/know-your-meme-links.R
Expand Up @@ -2,8 +2,8 @@ library(readr)
library(usethis)

meme_links <- read_csv(
"data-raw/know-your-meme-links.csv",
"data-raw/know-your-meme-links.csv",
col_types = cols(.default = col_character())
)

use_data(meme_links, internal = TRUE)
use_data(meme_links)
Binary file modified data/blankmemes.rda
Binary file not shown.
Binary file modified inst/extdata/kevindwight.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified inst/extdata/yodawg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions man/meme_add.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6dcd927

Please sign in to comment.