tsGetNumberPerYear: tsGetNumberPerYear

View source: R/eva_functions.R

tsGetNumberPerYearR Documentation

tsGetNumberPerYear

Description

tsGetNumberPerYear is a function that calculates the number of events per year based on a given time series and a set of locations.

Usage

tsGetNumberPerYear(ms, locs)

Arguments

ms

A data frame representing the time series data, where the first column contains the dates of the events.

locs

A vector of indices representing the locations of interest in the time series.

Value

A data frame with two columns: "year" and "Freq". The "year" column contains the years, and the "Freq" column contains the number of events per year.

Examples

# Create a sample time series data frame
set.seed(123)
ms <- data.frame(date = seq(as.Date("2000-01-01"), as.Date("2022-12-31"), by = "day"),
                values=rnorm(8401))
# Generate random events
events <- match(sample(ms$date, 100),ms$date)
# Get the number of events per year
tsGetNumberPerYear(ms, events)

RtsEva documentation built on June 24, 2024, 5:07 p.m.