crop | R Documentation |
crest.get_modern_data
Crop the dataset obtained from crest.get_modern_data
according
to an object of the class SpatialPolygonsDataFrame
.
crop(x, shp)
x |
A |
shp |
A shapefile to crop the data. Data points will be kept if their centroid is within the shape. |
An updated version of the crest.get_modern_data
.
## Not run: data(M1) ## We want only the data covering Nigeria M2 <- M1[M1$COUNTRY == 'Nigeria', ] data(reconstr) reconstr.cropped <- crop(reconstr, M2) data1 <- raster::rasterFromXYZ(reconstr$modelling$climate_space[, 1:3], crs=raster::crs(M1)) data2 <- raster::rasterFromXYZ(reconstr.cropped$modelling$climate_space[, 1:3], crs=raster::crs(M1)) layout(matrix(c(1,2,3,4), byrow=FALSE, ncol=2), width=1, height=c(0.2, 0.8)) plot_map_eqearth(data1, brks.pos=seq(13,29,2), colour_scale=TRUE, title='Full dataset', zlim=c(13, 29)) plot_map_eqearth(data2, brks.pos=seq(13,29,2), colour_scale=TRUE, title='Cropped dataset', zlim=c(13, 29)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.