Learn R Programming

wxgenR (version 1.4.4)

spellLengths: Spell length calculation

Description

Function to calculate the length (duration in years) of wet or dry periods.

Usage

spellLengths(s)

Value

Returns a list object containing a vector of dry spell lengths and a vector of wet spell lengths.

Arguments

s

A binary vector of 0 dry and 1 wet only.

Examples

Run this code

 #use 0 for dry and 1 for wet years
 spells = c(0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0)

 spellLengths(spells)

Run the code above in your browser using DataLab