Learn R Programming

RMAWGEN (version 1.3.9.3)

extractmonths: Extracts the rows of a matrix corresponding to requested months of a year given the date (origin) of the first row

Description

Extracts the rows of a matrix corresponding to requested months of a year given the date (origin) of the first row

Usage

extractmonths(
  data = array(1:ndim_max, dim = c(ndim_max, 1)),
  ndim_max = 1e+05,
  when = c("Dec", "Jan", "Feb"),
  year = NULL,
  origin = "1961-1-1"
)

Value

a matrix containing the requested rows

Arguments

data

an input data matrix where each row corresponds to a daily record

ndim_max

maximum (integer) number of rows in data where to find when. Default is 100000 and works if data is missing.

when

character vactor of months for which the data are required. It must be a subset of c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

year

year(s) when data must be extracted

origin

date corresponding to the first row of data

Author

Emanuele Cordano, Emanuele Eccel

See Also

extractdays

Examples

Run this code

extractmonths()

data(trentino)
dates <- sprintf("%02d-%02d-%02d",TEMPERATURE_MAX$year,TEMPERATURE_MAX$month,TEMPERATURE_MAX$day)
origin <- dates[1]
out <- extractmonths(data=TEMPERATURE_MAX,origin=origin)


Run the code above in your browser using DataLab