Learn R Programming

futureheatwaves (version 1.0.3)

IDHeatwavesAlternative: Identify heat waves in a time series

Description

This function identifies heat waves in a time series of temperature data using a heat wave definition that a heat wave must be a certain number of days above the greater of either a given threshold or 80 degrees Fahrenheit.

Usage

IDHeatwavesAlternative(threshold, datafr, numDays)

Arguments

threshold
Numeric string with threshold temperature used in the heat wave definition, in degrees Fahrenheit.
datafr
A dataframe with daily temperature projections in the the city being processed. This dataframe must have two columns: (1) the first column must have the date of each observation, with class "Date" and; (2) the second column must have temperatures in degrees Fahrenheit. In the normal running of this package, this dataframe will be generated by the closure created by createCityProcessor.
numDays
Integer greater than 0 giving the number of days to use in the extreme event definition (e.g., numDays = 2 would define a heat wave as two or more days above the threshold temperature).

Value

Returns the dataframe entered as datafr, but with new columns providing heat wave identifiers. The returned dataframe will have new columns for whether a day was part of a heat wave (hw, 0 / 1), and if it was part of a heat wave, the number of the heat wave (hw.number).

Examples

Run this code

data(datafr)
hw_ids <- IDHeatwavesAlternative(threshold = 80, datafr = datafr,
                                 numDays = 3)


Run the code above in your browser using DataLab