n<-79
s<--54
w<--166
e<-178
myPoly1<-bbox2sf(n,s,e,w)
plot(myPoly1)
# bbox as a 2 x 2 matrix as produced by sp:bbox
mybbox<-matrix(c(w,e,s,n),nrow=2,byrow=TRUE)
myPoly2<-bbox2sf(bbox=mybbox)
plot(myPoly2,border="red")
# bbox as produced by sf:st_bbox
if (require(sf)) {
myPoly3<-bbox2sf(bbox=st_bbox(myPoly2))
plot(myPoly3,border="blue")
}
Run the code above in your browser using DataLab