Personal I'm creating a package with some functions one of them depends on another package, as "gives the signal" for the 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)