1
Staff I am creating a package with some functions one of them depends on another package, as "gives the signal" for R understand and install this package? The package I depend on is raster
.
a = matrix(c(0,0,2,0,2,2,0,2), byrow = T, ncol = 2)
b = list(matrix(c(0.5, 0 ,1 , 1, 1.5, 0), ncol = 2, byrow = T))
polygon.intersection <- function(polygon1,polygon2){
polygon11 = as(polygon1, "gpc.poly")
polygon22 = as(polygon2, "gpc.poly")
res = intersect(polygon11, polygon22)
if(is.na(get.bbox(res)$x[[1]])) res = matrix(c(0,0,0,0), ncol = 2)
else res1 = as(res, "matrix")
res1
}
polygon.intersection(a,b)
My
import
it’s like this, but it’s not working.– Wagner Jorge
Why doesn’t it work? The
Imports
does not load the package, only changes the installation. Ideally you always usepacote::função
so you don’t have to uselibrary
and make the code clearer.– Molx