Subset time series

Description

Get subsets from objects of class twdtw*.

Usage

1
2
3
4
5
6
7
8
9
## S4 method for signature 'twdtwTimeSeries'
subset(x, labels = NULL)

## S4 method for signature 'twdtwMatches'
subset(x, timeseries.labels = NULL,
  patterns.labels = NULL, k = NULL)

## S4 method for signature 'twdtwRaster'
subset(x, e = NULL, layers = NULL)

Arguments

x

An objects of class twdtw*.

labels

character vector with time series labels.

timeseries.labels

a vector with labels of the time series.

patterns.labels

a vector with labels of the patterns.

k

A positive integer. The index of the last alignment to include in the subset.

e

An extent object, or any object from which an Extent object can be extracted. See crop for details.

layers

a vector with the names of the twdtwRaster object to include in the subset.

Value

an object of class twdtw*.

Author(s)

Victor Maus, vwmaus1@gmail.com

See Also

twdtwRaster-class, twdtwTimeSeries-class, and twdtwMatches-class

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
26
27
28
# Getting time series from objects of class twdtwTimeSeries
ts = twdtwTimeSeries(example_ts.list)
ts = subset(ts, 2)
ts
# Getting time series from objects of class twdtwTimeSeries
patt = twdtwTimeSeries(patterns.list)
mat = twdtwApply(x=ts, y=patt, weight.fun=logisticWeight(-0.1,100))
mat = subset(mat, k=4)

## This example creates a twdtwRaster object and extract time series from it. 

# Creating objects of class twdtwRaster with evi and ndvi time series 
evi = brick(system.file("lucc_MT/data/evi.tif", package="dtwSat"))
ndvi = brick(system.file("lucc_MT/data/ndvi.tif", package="dtwSat"))
timeline = scan(system.file("lucc_MT/data/timeline", package="dtwSat"), what="date")
rts = twdtwRaster(evi, ndvi, timeline=timeline)

rts_evi = subset(rts, layers="evi")

field_samples = read.csv(system.file("lucc_MT/data/samples.csv", package="dtwSat"))
prj_string = scan(system.file("lucc_MT/data/samples_projection", package="dtwSat"), 
                  what = "character")

# Extract time series 
ts_evi = getTimeSeries(rts_evi, y = field_samples, proj4string = prj_string)

# subset all labels = "Forest"
ts_forest = subset(ts_evi, labels="Forest")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.