Learn R Programming

CAWaR (version 0.0.2)

analyseTS: analyseTS

Description

Summarizes multi-band raster data within each element of a SpatialPolygons object.

Usage

analyseTS(x, y, out.plot = NULL)

Arguments

x

Object of class data.frame.

y

Vector of class character or numeric with a length equal to the number of rows in x.

out.plot

Specifies the data path where plots should be stored.

Value

A SpatialPointsDataDrame with the coordinate pairs for each of the sampled pixels.

Details

For each unique value in y, the function will select the rows in x that correspond to it and estimate the median, Median Absolute Deviation (MAD), minimum, maximum, mean and standard deviation for each column. Then, the function will build a plot showing the median and draw a buffer that expresses the minimum and maximum. The final output is a list consisting of:

  • y.statistics - Median, minimum and maximum values for each column in x over each unique class in y.

  • plots - List of line plots for each unique element in y.

If out.plot is set, the function will save each plot as 10x10 cm PNG files within the specified path.

See Also

extractTS phenoCropVal phenoCropClass

Examples

Run this code
# NOT RUN {
{

require(raster)
require(fieldRS)

# read raster data
r <- brick(system.file("extdata", "ndvi.tif", package="fieldRS"))

# read field data
data(fieldData)
data(fieldDataTS)

a.ts <- analyseTS(as.data.frame(fieldDataTS$weighted.mean), fieldData$crop)

}
# }

Run the code above in your browser using DataLab