I am trying to reproduce the example posted on
Extracting intersection areas in R
Although, when I try to create the SpatialPolygon "p2", R returns the error: "Error in as.vector(x) : no method for coercing this S4 class to a vector".
Any suggestions why is it happening? How can I fix it?