This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assign.events <- function(df, datetime.name="DATETIME", value.name="VALUE", interevent=8, threshold=0.1) { | |
# assigns events to data frame such as storm events or discharge events | |
require(plyr) | |
if (!(datetime.name %in% names(df))) { | |
stop(paste0('Could not find datetime column called ', datetime.name)) | |
} | |
if (!(value.name %in% names(df))) { | |
stop(paste0('Could not find value column called ', value.name)) | |
} | |
if (!is.regular(df[, datetime.name])) { |