I am doing a time series analysis of NDVI using the bfast package in R. Bfast requires a time series (TS) object.
I have successfully created a data frame with the NDVI at various point locations for tiffs in a given directory (code for this is at the bottom of the post).
Problem 1: the code does not extract the date of the images. Landsat file names give year and Julian day starting at the 10th character (YYYYDDD) so this should be possible. But how? And will the Julian day be recognized as a date?
Problem 2: once the date is extracted, how do I create TS object from the data frame?
Thanks for any tips! I'm new at R, so be gentle.
Code for extracting values at point locations:
require(raster) require(rdgal) require(sp) setwd("C:\\Users\\Work\\LSTest") pts <- readOGR(getwd(), "MyPoints") LS.files <- list.files(getwd(),pattern="\\.tif$", full.names=FALSE) India.LS <- stack(LS.files) pts@data <- data.frame(pts@data, extract(India.LS, pts))