subset by index | R Documentation |
Extract layers from a Raster*TS
object by index (i.e. double bracket, [[
).
This function can be used to extract a raster layer or a set of raster lasyers based on the time-index using date-like string. The format must left-specied with respect to the standard ISO:8601 time format "CCYY-MM-DD HH:MM:SS". It is also possible to specify a range of times via the index-based subsetting, using ISO-recommended "/" as the range operator. The basic form is "from/to", where both are optional. If either side is missing, it is interpretted as a request to retrieve raster layers from the beginning, or through the end of the raster time series object. Both subset
function and '[['
operator do the same thing.
RasterStackTS
or RasterBrickTS
.
x[[i, ...]]
Arguments
i
- indicates the layers (represented as a vector of numeric or character string relevant to time index, or by a time-based object).
...
- same as ...
in subset
function in package raster
Babak Naimi
subset
## Not run:
file <- system.file("external/ndvi", package="rts")
ndvi <- rts(file) # read the ndvi time series from the specified file
s1 <- ndvi[["2000-01-01/2000-05-31"]]
s1
plot(s1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.