bfastts {bfast} | R Documentation |
Create a regular time series object by combining data and date information
Description
Create a regular time series object by combining measurements (data) and time (dates) information.
Usage
bfastts(data, dates, type = c("irregular", "16-day", "10-day"))
Arguments
data |
A data vector or matrix where columns represent variables |
dates |
Optional input of dates for each measurement in the 'data' variable. In case the data is a irregular time series, a vector with 'dates' for each measurement can be supplied using this 'dates' variable. The irregular data will be linked with the dates vector to create daily regular time series with a frequency = 365. Extra days in leap years might cause problems. Please be careful using this option as it is experimental. Feedback is welcome. |
type |
( |
Details
bfastts
create a regular time series
Value
bfastts
returns an object of class "ts"
, i.e., a list
with components as follows.
zz |
a regular |
Author(s)
Achim Zeileis, Jan Verbesselt
See Also
Examples
# 16-day time series (i.e. MODIS)
timedf <- data.frame(y = som$NDVI.b, dates = dates[1:nrow(som)])
bfastts(timedf$y, timedf$dates, type = "16-day")
# Irregular
head(bfastts(timedf$y, timedf$dates, type = "irregular"), 50)
## Not run:
# Example of use with a raster
library("raster")
f <- system.file("extdata/modisraster.grd", package="bfast")
modisbrick <- brick(f)
ndvi <- bfastts(as.vector(modisbrick[1]), dates, type = c("16-day")) ## data of pixel 1
plot(ndvi/10000)
# Time series of 4 pixels
modis_ts = t(as.data.frame(modisbrick))[,1:4]
# Data with multiple columns, 2-4 are external regressors
ndvi <- bfastts(modis_ts, dates, type = c("16-day"))
plot(ndvi/10000)
## End(Not run)