Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webshot generates warning message if v #116

Open
warnes opened this issue Apr 27, 2023 · 0 comments
Open

webshot generates warning message if v #116

warnes opened this issue Apr 27, 2023 · 0 comments

Comments

@warnes
Copy link
Contributor

warnes commented Apr 27, 2023

When webshot is called with the cliprect parameter set to "viewport" it generates the warning message:
Warning: 'length(x) = 4 > 1' in coercion to 'logical(1)'.

Example

webshot::webshot("http://r-project.org", cliprect = "viewport")

This appears to be generated from these lines in mapshot:

webshot/R/webshot.R

Lines 191 to 204 in e5df3d0

cliprect <- lapply(cliprect, function(x) {
if (is.character(x)) {
if (x == "viewport") {
x <- c(0, 0, vwidth, vheight)
} else {
stop("Invalid value for cliprect: ", x)
}
} else {
if (!is.numeric(x) || length(x) != 4) {
stop("'cliprect' must be a 4-element numeric vector or a list of such vectors")
}
}
x
})

A simple solution would be to check for cliprect=="viewport" earlier in the function.

warnes added a commit to Warnes-Innovations/webshot that referenced this issue Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant