subset: Subset layers in a raster time series object

Description Details Value Methods Author(s) See Also Examples

Description

Extract layers from a Raster*TS object.

Details

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.

Value

RasterStackTS or RasterBrickTS.

Methods

subset(x, subset, ...)

Arguments

x is a raster time series (Raster*TS) object created by rts

subset is 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

Author(s)

Babak Naimi

naimi.b@gmail.com

http://r-gis.net

See Also

subset and [.xts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
file <- system.file("external/ndvi", package="rts")

ndvi <- rts(file) # read the ndvi time series from the specified file

s1 <- subset(ndvi,1:5) # subset the first 5 raster layers into a new raster time series object

s1

plot(s1)

s2 <- subset(ndvi,"/2000") # subset all layers till end of year 2000

s2

plot(s2)

s3 <- subset(ndvi,"2000-01-01/2000-05-31")

s3

plot(s3)


## End(Not run)

rts documentation built on Oct. 17, 2021, 1:07 a.m.

Related to subset in rts...