[Eventstudies-commits] r311 - pkg/inst/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 2 20:03:39 CEST 2014


Author: chiraganand
Date: 2014-05-02 20:03:39 +0200 (Fri, 02 May 2014)
New Revision: 311

Modified:
   pkg/inst/tests/test_eventstudy.R
Log:
Added test case for checking missing event date in data.

Modified: pkg/inst/tests/test_eventstudy.R
===================================================================
--- pkg/inst/tests/test_eventstudy.R	2014-05-02 15:23:23 UTC (rev 310)
+++ pkg/inst/tests/test_eventstudy.R	2014-05-02 18:03:39 UTC (rev 311)
@@ -57,5 +57,14 @@
                                          "wdatamissing", "wrongspan"),
                                        class = "factor")),
                                 .Names = c("z.e", "outcomes" ))))
+
+## Check the previous date
+cat("\nTesting handling of missing data on event date: ")
+eventdate <- "2004-01-10"
+eventdate_output <- "2004-01-09"
+eventslist <- data.frame(outcome.unit = "ITC", event.when = eventdate,
+                         stringsAsFactors = FALSE)
+a <- phys2eventtime(p, eventslist, width = 2)
+expect_that(as.numeric(a$z.e["0",]),
+            equals(as.numeric(p$ITC[as.Date(eventdate_output), ])))
 })
-## TODO: check for missing data on event time, it should pick up data on the last available timestamp.



More information about the Eventstudies-commits mailing list