Description Usage Arguments Value Author(s) See Also Examples
View source: R/FUNCTION_rstFun.R
This function allows the conversion of a xyz data.frame with non-equally spaced data into a raster
1 2 3 4 5 |
dta |
xyz data.frame, with WGS 84 geographical coordinates. x in decimal degrees +- 180º (West, East) y in decimal degrees +- 90º (South, North) |
res |
Numeric. Resolution of output raster. Defaults to 1 x 1º |
ext |
Vector or 2x2 matrix of output raster extent. Defaults to c(-180, -90, 180, 90) |
... |
function to aggregate spatial data |
Returns a raster, with WGS 84 geographical projection
Marisa Vedor, Ivo da Costa, Nuno Queiroz
raster
rasterize
SpatialPointsDataFrame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Raster resolution
resolution <- 1
# Polygon of extent
ext = matrix(c(-180, 90,
180, 90,
180, -90,
-180, -90),
ncol = 2, byrow = TRUE)
# Read data #
tbl <- data('grid_data')
# Create raster of fishing days
rst <- rstFun(tbl[, c('x', 'y', 'nBoats')], mean, na.rm = TRUE,
res = resolution, ext = ext)
plot(rst)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.