Skip to content

webshot generates warning message if v #116

Description

@warnes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions