Skip to content

Commit

Permalink
Don't run examples in check
Browse files Browse the repository at this point in the history
  • Loading branch information
willgearty committed Dec 20, 2023
1 parent 1c4c252 commit 1052dce
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion R/add_phylopic.r
Original file line number Diff line number Diff line change
Expand Up @@ -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) +
Expand All @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion R/add_phylopic_base.r
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion R/browse_phylopic.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 1 addition & 2 deletions R/geom_phylopic.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
4 changes: 2 additions & 2 deletions R/get_attribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions R/get_phylopic.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------------------------------------
Expand Down Expand Up @@ -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))
Expand Down
3 changes: 2 additions & 1 deletion R/get_uuid.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 -----------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions R/save_phylopic.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions man/add_phylopic.Rd

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

2 changes: 2 additions & 0 deletions man/add_phylopic_base.Rd

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

2 changes: 2 additions & 0 deletions man/browse_phylopic.Rd

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

3 changes: 2 additions & 1 deletion man/get_attribution.Rd

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

2 changes: 2 additions & 0 deletions man/get_phylopic.Rd

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

2 changes: 2 additions & 0 deletions man/get_uuid.Rd

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

0 comments on commit 1052dce

Please sign in to comment.