Skip to content

Commit

Permalink
Fixed a warning message in the get_mp_pic() function, produced by the…
Browse files Browse the repository at this point in the history
… 'imager' package
  • Loading branch information
martigso committed Oct 11, 2023
1 parent 1ba797d commit 031195a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/get_mp_pic.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ get_mp_pic <- function(mpid = NA, size = "middels",
if(status$category != "Success") stop(paste0("Response of ", url, " returned as '", status$message, "'"), call. = FALSE)

if(is.na(destfile) == TRUE & show_plot == TRUE){
p <- imager::load.image(url)
plot(p, labels = FALSE)
if(require("imager") == FALSE) stop("Package 'imager' required for plotting images")
require(imager, quietly = TRUE)
p <- load.image(url)
plot(p, axes = FALSE)
}

if(is.na(destfile) == TRUE & show_plot == FALSE){
Expand All @@ -61,7 +63,7 @@ get_mp_pic <- function(mpid = NA, size = "middels",
if(is.na(destfile) == FALSE & show_plot == TRUE){
download.file(url, destfile = destfile)
p <- imager::load.image(destfile)
plot(p,)
plot(p, axes = FALSE)
}

if(is.na(destfile) == FALSE & show_plot == FALSE){
Expand Down

0 comments on commit 031195a

Please sign in to comment.