[Vars-commits] r60 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Dec 12 17:02:38 CET 2009


Author: matthieu
Date: 2009-12-12 17:02:38 +0100 (Sat, 12 Dec 2009)
New Revision: 60

Modified:
   pkg/R/causality.R
Log:
Check if argument cause match variables names


Modified: pkg/R/causality.R
===================================================================
--- pkg/R/causality.R	2009-12-11 11:52:28 UTC (rev 59)
+++ pkg/R/causality.R	2009-12-12 16:02:38 UTC (rev 60)
@@ -13,6 +13,8 @@
   if(is.null(cause)){
     cause <- y.names[1]
     warning("\nArgument 'cause' has not been specified;\nusing first variable in 'x$y' as cause variable.\n")
+  } else {
+    if(!all(cause%in%y.names)) stop("Argument cause does not match variables names.\n")
   }
   y1.names <- subset(y.names, subset = y.names %in% cause)
   y2.names <- subset(y.names, subset = !(y.names %in% cause))



More information about the Vars-commits mailing list