| get_ts | R Documentation |
Get time series
get_ts(x, long, lat) ## S3 method for class 'TimeRaster' get_ts(x, long, lat) ## Default S3 method: get_ts(x, long, lat)
x |
An object of class |
long |
(numeric) a longitude value |
lat |
(numeric) a latitude value |
An xts object
## Not run:
zip <- system.file("examples", "prismrain.zip", package = "timeraster")
dir <- paste0(tempdir(), "/prismrain")
dir <- "prismrain"
dir.create(dir)
unzip(zip, exdir = dir)
files <- list.files(dir, full.names = TRUE, pattern = ".tif$", all.files = TRUE)
# Create raster stack from file paths
rf <- raster::stack(files)
# Create a time series object
library("xts")
ts <- xts(1:365, as.Date("2014-01-01") + 0:364)
# Create TimeRaster object
res <- time_raster(files, ts)
# Pull out xts object
get_ts(res, -67, 45)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.