Learn R Programming

gimms (version 0.2.0)

monthlyIndices: Monthly indices from GIMMS filenames

Description

Create numeric monthly indices from (local or online) GIMMS filenames as input for the monthlyComposite function.

Usage

monthlyIndices(x, pos1 = 4L, pos2 = 8L, timestamp = FALSE, ...)

Arguments

x
Character. Vector of (local or online) filenames.
pos1,pos2
Numeric. The first and last element of the date string in 'x', defaults to the GIMMS naming convention; see substr.
timestamp
Logical. If TRUE, an actual timestamp (formatted according to ...) is returned rather than a vector of indices.
...
Further arguments passed on to strftime.

Value

  • A numeric vector with unique monthly indices or, if timestamp = TRUE, a character vector with formatted timestamps.

See Also

monthlyComposite.

Examples

Run this code
## vector of filenames
gimms_files <- c("geo85aug15a.n09-VI3g", "geo85aug15b.n09-VI3g",
                 "geo85sep15a.n09-VI3g", "geo85sep15b.n09-VI3g",
                 "geo85oct15a.n09-VI3g", "geo85oct15b.n09-VI3g")

## extract monthly indices
monthlyIndices(gimms_files)
monthlyIndices(gimms_files, timestamp = TRUE, format = "%b %y")

Run the code above in your browser using DataLab