[Eventstudies-commits] r161 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 22 11:01:41 CET 2014


Author: chiraganand
Date: 2014-01-22 11:01:36 +0100 (Wed, 22 Jan 2014)
New Revision: 161

Modified:
   pkg/R/phys2eventtime.R
Log:
Throw out an error if the z argument to phys2eventtime() is a vector.

Modified: pkg/R/phys2eventtime.R
===================================================================
--- pkg/R/phys2eventtime.R	2014-01-16 11:09:57 UTC (rev 160)
+++ pkg/R/phys2eventtime.R	2014-01-22 10:01:36 UTC (rev 161)
@@ -20,6 +20,12 @@
   # If this can't be done, then send back NULL with an error code.
   ## takes the event list as an argument and uses already existing
   ## time-series variable z
+
+                                        # check the dimensions of "z""
+  if (is.null(ncol(z))) {
+    stop(paste(deparse("z"), "should be a zoo series with at least one column."))
+  }
+
   timeshift <- function(x) {
     firm.present <- match(x[1], colnames(z), nomatch = -1) != -1
     if (!firm.present) {



More information about the Eventstudies-commits mailing list