[Eventstudies-commits] r375 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 9 03:12:51 CEST 2014


Author: chiraganand
Date: 2014-10-09 03:12:51 +0200 (Thu, 09 Oct 2014)
New Revision: 375

Modified:
   pkg/R/phys2eventtime.R
Log:
Added condition to check date-time class column inside events list.

Modified: pkg/R/phys2eventtime.R
===================================================================
--- pkg/R/phys2eventtime.R	2014-10-07 23:29:58 UTC (rev 374)
+++ pkg/R/phys2eventtime.R	2014-10-09 01:12:51 UTC (rev 375)
@@ -15,6 +15,9 @@
   if (is.null(ncol(z))) {
     stop(paste("'z' should be of class zoo/xts with at least one column. Use '[' with drop = FALSE"))
   }
+  if (!any(class(events$when) %in% c("POSIXt", "Date"))) {
+      stop("events$when should be one of 'Date' or 'date-time' classes.")
+  }
 
   answer <- lapply(1:nrow(events), function(i) timeshift(events[i, ], z))
   outcomes <- sapply(answer, function(x) x$outcome)



More information about the Eventstudies-commits mailing list