diff --git a/NEWS.md b/NEWS.md index 11e239a..f5f3b88 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ * changed the defaults and behavior of the color and fill argument/aesthetics to better maintain backwards compatibility but also prevent unnecessary outlines (#87) * added resolve_phylopic (#66) * pick_phylopic now accepts a list of uuids via the uuid argument (#95) +* fixed check behavior on CRAN (all tests and examples are now skipped) # rphylopic 1.2.2 diff --git a/R/add_phylopic.r b/R/add_phylopic.r index 42a593d..7d04090 100644 --- a/R/add_phylopic.r +++ b/R/add_phylopic.r @@ -56,7 +56,7 @@ #' Also, outline colors do not currently work for png array objects. #' @importFrom ggplot2 annotate #' @export -#' @examples +#' @examples \dontrun{ #' # Put a silhouette behind a plot based on a taxonomic name #' library(ggplot2) #' ggplot(iris) + @@ -81,6 +81,7 @@ #' fill = fills, alpha = alpha, angle = angle, #' horizontal = hor, vertical = ver) #' p + ggtitle("R Cat Herd!!") +#' } add_phylopic <- function(img = NULL, name = NULL, uuid = NULL, filter = NULL, x, y, ysize = Inf, alpha = 1, color = NA, fill = "black", diff --git a/R/add_phylopic_base.r b/R/add_phylopic_base.r index 64fbc58..a8790cd 100644 --- a/R/add_phylopic_base.r +++ b/R/add_phylopic_base.r @@ -64,7 +64,7 @@ #' @importFrom grImport2 grid.picture #' @importFrom methods is slotNames #' @export -#' @examples +#' @examples \dontrun{ #' # single image #' plot(1, 1, type = "n", main = "A cat") #' add_phylopic_base(uuid = "23cd6aa4-9587-4a2e-8e26-de42885004c9", @@ -95,6 +95,7 @@ #' add_phylopic_base(img = cat, alpha = 0.2) #' # overlay smaller cats #' add_phylopic_base(img = cat, x = posx, y = posy, ysize = size, alpha = 0.8) +#' } add_phylopic_base <- function(img = NULL, name = NULL, uuid = NULL, filter = NULL, x = NULL, y = NULL, ysize = NULL, diff --git a/R/browse_phylopic.R b/R/browse_phylopic.R index 600242e..b77bc0f 100644 --- a/R/browse_phylopic.R +++ b/R/browse_phylopic.R @@ -19,8 +19,9 @@ #' #' @importFrom utils browseURL #' @export -#' @examples +#' @examples \dontrun{ #' url <- browse_phylopic(name = "Acropora cervicornis") +#' } browse_phylopic <- function(name = NULL, uuid = NULL) { # Error handling ------------------------------------------------------- if (!is.null(name) && !is.character(name)) { diff --git a/R/geom_phylopic.R b/R/geom_phylopic.R index e5acc4d..28fa4c1 100644 --- a/R/geom_phylopic.R +++ b/R/geom_phylopic.R @@ -68,8 +68,7 @@ phylopic_env <- new.env() #' @inheritParams pick_phylopic #' @importFrom ggplot2 layer #' @export -#' @examples -#' \dontrun{ +#' @examples \dontrun{ #' library(ggplot2) #' df <- data.frame(x = c(2, 4), y = c(10, 20), #' name = c("Felis silvestris catus", "Odobenus rosmarus")) diff --git a/R/get_attribution.R b/R/get_attribution.R index 3c94023..1f1578e 100644 --- a/R/get_attribution.R +++ b/R/get_attribution.R @@ -22,12 +22,12 @@ #' @importFrom knitr combine_words #' @importFrom utils packageVersion #' @export -#' @examples +#' @examples \dontrun{ #' # Get valid uuid #' uuid <- get_uuid(name = "Acropora cervicornis") #' # Get attribution data for uuid #' attri <- get_attribution(uuid = uuid) -#' \dontrun{ +#' #' # Get list of valid uuids #' uuids <- get_uuid(name = "Scleractinia", n = 5) #' # Get attribution data for uuids diff --git a/R/get_phylopic.R b/R/get_phylopic.R index dd30646..ecb4a03 100644 --- a/R/get_phylopic.R +++ b/R/get_phylopic.R @@ -23,18 +23,17 @@ #' is returned. If `format` is "raster", a png array representing the #' rasterized image is returned. Either way, the uuid and download url are #' included as the "uuid" and "url" attributes, respectively. -#' @importFrom rsvg rsvg_png -#' @importFrom png readPNG #' @importFrom grid grid.newpage grid.raster #' @importFrom grImport2 grid.picture #' @export -#' @examples +#' @examples \dontrun{ #' # uuid #' uuid <- "9fae30cd-fb59-4a81-a39c-e1826a35f612" #' #' # Get data for an image #' img_svg <- get_phylopic(uuid, format = "vector") # vector format #' img_png <- get_phylopic(uuid, format = "raster") # raster format +#' } get_phylopic <- function(uuid = NULL, format = "vector", height = 512, preview = FALSE) { # Error handling ------------------------------------------------------- @@ -123,6 +122,8 @@ get_png <- function(x) { img_new } +#' @importFrom rsvg rsvg_png +#' @importFrom png readPNG make_png <- function(url, height) { tryCatch({ img_new <- readPNG(rsvg_png(url, height = height)) diff --git a/R/get_uuid.R b/R/get_uuid.R index 9149d9e..1108334 100644 --- a/R/get_uuid.R +++ b/R/get_uuid.R @@ -30,9 +30,10 @@ #' [pick_phylopic] to visually select the desired uuid/url. #' @importFrom stats setNames #' @export -#' @examples +#' @examples \dontrun{ #' uuid <- get_uuid(name = "Acropora cervicornis") #' uuid <- get_uuid(name = "Dinosauria", n = 5, url = TRUE) +#' } get_uuid <- function(name = NULL, img = NULL, n = 1, filter = NULL, url = FALSE) { # Handle img ----------------------------------------------------------- diff --git a/R/save_phylopic.R b/R/save_phylopic.R index af50f0d..398578c 100644 --- a/R/save_phylopic.R +++ b/R/save_phylopic.R @@ -32,8 +32,7 @@ #' @importFrom grImport2 grid.picture #' @importFrom methods is #' @export -#' @examples -#' \dontrun{ +#' @examples \dontrun{ #' # Get image data #' img <- get_phylopic("27356f15-3cf8-47e8-ab41-71c6260b2724") #' # Save file diff --git a/man/add_phylopic.Rd b/man/add_phylopic.Rd index ee18b0a..fb088cd 100644 --- a/man/add_phylopic.Rd +++ b/man/add_phylopic.Rd @@ -96,6 +96,7 @@ Note that png array objects can only be rotated by multiples of 90 degrees. Also, outline colors do not currently work for png array objects. } \examples{ +\dontrun{ # Put a silhouette behind a plot based on a taxonomic name library(ggplot2) ggplot(iris) + @@ -121,3 +122,4 @@ p <- ggplot(data.frame(cat.x = posx, cat.y = posy), aes(cat.x, cat.y)) + horizontal = hor, vertical = ver) p + ggtitle("R Cat Herd!!") } +} diff --git a/man/add_phylopic_base.Rd b/man/add_phylopic_base.Rd index 197ba36..affdfb3 100644 --- a/man/add_phylopic_base.Rd +++ b/man/add_phylopic_base.Rd @@ -101,6 +101,7 @@ Note that png array objects can only be rotated by multiples of 90 degrees. Also, outline colors do not currently work for png array objects. } \examples{ +\dontrun{ # single image plot(1, 1, type = "n", main = "A cat") add_phylopic_base(uuid = "23cd6aa4-9587-4a2e-8e26-de42885004c9", @@ -132,3 +133,4 @@ add_phylopic_base(img = cat, alpha = 0.2) # overlay smaller cats add_phylopic_base(img = cat, x = posx, y = posy, ysize = size, alpha = 0.8) } +} diff --git a/man/browse_phylopic.Rd b/man/browse_phylopic.Rd index f0ce366..64f1fc9 100644 --- a/man/browse_phylopic.Rd +++ b/man/browse_phylopic.Rd @@ -29,5 +29,7 @@ This function returns a PhyloPic url for an input \code{name} or is returned and opened instead. } \examples{ +\dontrun{ url <- browse_phylopic(name = "Acropora cervicornis") } +} diff --git a/man/get_attribution.Rd b/man/get_attribution.Rd index c78948a..dfec760 100644 --- a/man/get_attribution.Rd +++ b/man/get_attribution.Rd @@ -33,11 +33,12 @@ image uuid, license, and license abbreviation. If \code{text} is set to and license type is returned. } \examples{ +\dontrun{ # Get valid uuid uuid <- get_uuid(name = "Acropora cervicornis") # Get attribution data for uuid attri <- get_attribution(uuid = uuid) -\dontrun{ + # Get list of valid uuids uuids <- get_uuid(name = "Scleractinia", n = 5) # Get attribution data for uuids diff --git a/man/get_phylopic.Rd b/man/get_phylopic.Rd index 6080180..922e71a 100644 --- a/man/get_phylopic.Rd +++ b/man/get_phylopic.Rd @@ -50,6 +50,7 @@ downloaded from PhyloPic. If not, the vector image from PhyloPic will be used to render a raster object of the desired size. } \examples{ +\dontrun{ # uuid uuid <- "9fae30cd-fb59-4a81-a39c-e1826a35f612" @@ -57,3 +58,4 @@ uuid <- "9fae30cd-fb59-4a81-a39c-e1826a35f612" img_svg <- get_phylopic(uuid, format = "vector") # vector format img_png <- get_phylopic(uuid, format = "raster") # raster format } +} diff --git a/man/get_uuid.Rd b/man/get_uuid.Rd index 3f45e28..307977a 100644 --- a/man/get_uuid.Rd +++ b/man/get_uuid.Rd @@ -44,6 +44,8 @@ This function returns uuid(s) or image url (svg) for an input \link{pick_phylopic} to visually select the desired uuid/url. } \examples{ +\dontrun{ uuid <- get_uuid(name = "Acropora cervicornis") uuid <- get_uuid(name = "Dinosauria", n = 5, url = TRUE) } +}