Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><em>UPDATE : This problem is also discussed on the R mailing list, and it turned out to be a bug/inconsistency in the resolving of passed arguments in specific cases. This is reported to R. The discussion can be found at :</em> <a href="http://r.789695.n4.nabble.com/Passing-arguments-between-S4-methods-fails-within-a-function-bug-example-with-raster-package-td2339750.html" rel="nofollow noreferrer" title="archive of R mailing list">Nabble</a></p> <hr> <p>Quite an interesting problem. When you check</p> <pre><code>showMethods("xyValues",incl=T) </code></pre> <p>There are two important chunks of code. The one with signature vector for xy, and one for xy as a matrix. As your object is a "RasterLayer" object, you need to make sure origin.point is a matrix. This is pretty counterintuitive actually if we look at the code</p> <pre><code>object="Raster", xy="vector" function (object, xy, ...) { if (length(xy) == 2) { callGeneric(object, matrix(xy, ncol = 2), ...) } else { stop("xy coordinates should be a two-column matrix or data.frame, or a vector of two numbers.") } } </code></pre> <p>So this actually only transforms the xy argument to a matrix, and passes all other arguments to the next generic. The next one has to be this one then :</p> <pre><code>object="RasterLayer", xy="matrix" function (object, xy, ...) { .local &lt;- function (object, xy, method = "simple", buffer = NULL, fun = NULL, na.rm = TRUE) { if (dim(xy)[2] != 2) { stop("xy has wrong dimensions; it should have 2 columns") } if (!is.null(buffer)) { return(.xyvBuf(object, xy, buffer, fun, na.rm = na.rm)) } if (method == "bilinear") { return(.bilinearValue(object, xy)) } else if (method == "simple") { cells &lt;- cellFromXY(object, xy) return(.readCells(object, cells)) } else { stop("invalid method argument. Should be simple or bilinear.") } } .local(object, xy, ...) } </code></pre> <p>This one takes the argument "buffer". Why the value for the argument can't be found in the parse tree, I have no clue, but you could try to avoid the method cascade by giving a matrix as input instead of a vector.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload