Skip to main content
added 371 characters in body
Source Link

Another strange thing, if I type raster::intersect into the console I get

> raster::intersect
standardGeneric for "intersect" defined from package "base"

function (x, y) 
standardGeneric("intersect")
<environment: 0x5cc78f8>
Methods may be defined for arguments: x, y
Use  showMethods("intersect")  for currently available ones.

Another strange thing, if I type raster::intersect into the console I get

> raster::intersect
standardGeneric for "intersect" defined from package "base"

function (x, y) 
standardGeneric("intersect")
<environment: 0x5cc78f8>
Methods may be defined for arguments: x, y
Use  showMethods("intersect")  for currently available ones.
Source Link

Error with Intersecting Rasters and Lines in R

I'm trying to ''cut'' a spatial lines data frame object by a raster grid using R,

raster::intersect(SLDF, grid)

However, when I run this code I get,

Error in as.vector(x) : no method for coercing this S4 class to a vector

Here is my session info,

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
 [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] bindrcpp_0.2.2    viridis_0.5.1     viridisLite_0.3.0 flexsurv_1.1     
 [5] survival_2.42-3   raster_2.6-7      rgeos_0.3-27      rgdal_1.3-1      
 [9] sp_1.3-1          magrittr_1.5      dplyr_0.7.5      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17       pillar_1.2.3       compiler_3.4.4     RColorBrewer_1.1-2
 [5] plyr_1.8.4         bindr_0.1.1        tibble_1.4.2       gtable_0.2.0      
 [9] lattice_0.20-35    pkgconfig_2.0.1    rlang_0.2.1        Matrix_1.2-14     
[13] mvtnorm_1.0-8      gridExtra_2.3      grid_3.4.4         tidyselect_0.2.4  
[17] deSolve_1.21       mstate_0.2.11      glue_1.2.0         R6_2.2.2          
[21] purrr_0.2.5        ggplot2_2.2.1      scales_0.5.0       splines_3.4.4     
[25] assertthat_0.2.0   colorspace_1.3-2   quadprog_1.5-5     muhaz_1.2.6       
[29] lazyeval_0.2.1     munsell_0.5.0