From bfd494b4ace8b7862bd85ac229649aac016f0f0e Mon Sep 17 00:00:00 2001 From: Jessica Burnett Date: Tue, 7 May 2019 15:47:50 -0500 Subject: [PATCH] conditional change of timeseries object to class "timeseries" because `timeseries` is required to be of class "timeseries" i added a conditional statement that will force @param `timeseries` to a time series object using `ts()`. --- earlywarnings/R/sensitivity_ews.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/earlywarnings/R/sensitivity_ews.R b/earlywarnings/R/sensitivity_ews.R index 28469bc..1af1d8a 100644 --- a/earlywarnings/R/sensitivity_ews.R +++ b/earlywarnings/R/sensitivity_ews.R @@ -51,7 +51,9 @@ sensitivity_ews <- function(timeseries, indicator = c("ar1", "sd", "acf1", "sk", 100), spanrange = c(5, 100), degree = NULL, incrbandwidth = 20, incrspanrange = 10, logtransform = FALSE, interpolate = FALSE) { - # timeseries<-ts(timeseries) #strict data-types the input data as tseries object + # Ensure timeseries is of class timeseries + if(!is.ts(timeseries)) timeseries <- ts(timeseries)#strict data-types the input data as tseries object + # for use in later steps timeseries <- data.matrix(timeseries)