extractmonths: Extracts the rows of a matrix corresponding to requested...

View source: R/extractmonths.R

extractmonthsR Documentation

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"
)

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

Value

a matrix containing the requested rows

Note

It uses months and julian

Author(s)

Emanuele Cordano, Emanuele Eccel

See Also

extractdays

Examples


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)



ecor/RMAWGEN documentation built on Jan. 4, 2024, 5:56 p.m.