Learn R Programming

hydroTSM (version 0.3-5)

extract: Extract from Zoo

Description

Extracts from a zoo object all the values belonging to a given month, year or weather season.

Usage

extract(x, ...)

## S3 method for class 'default': extract(x, trgt, ...) ## S3 method for class 'zoo': extract(x, trgt, ...)

Arguments

x
zoo object
trgt
numeric or character indicating the elements to extract from x. Valid values are: 1) integer from 1 to 12: trgt is considered as a month (1=JAN, 2=FEB,...., 12=DEC), and all the values in x belonging to the month sp
...
further arguments passed to or from other methods

Value

  • a zoo object with the extracted values.

See Also

time2season, seasonalfunction, daily2annual, daily2monthly

Examples

Run this code
### Loading temperature data ##
data(SanMartinoPPts)
x <- SanMartinoPPts

## Extracting all the values belonging to February (FEB=2)
extract(x, trgt=2)

## Extracting all the values belonging to the year 1970
extract(x, trgt=1970)

## Extracting all the values belonging to the autumn
extract(x, trgt="SON")

Run the code above in your browser using DataLab