Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /R/jags.R [70b905] .. [5e69f8] Maximize Restore

  Switch to side-by-side view

--- a/R/jags.R
+++ b/R/jags.R
@@ -80,6 +80,18 @@
         unused.variables <- setdiff(v, varnames)
         for (i in seq(along=unused.variables)) {
             warning("Unused variable \"", unused.variables[i], "\" in data")
+        }
+        ### Check for data frames
+        df <- which(sapply(data, is.data.frame))
+        for (i in seq(along=df)) {
+            if (all(sapply(data[[df[i]]], is.numeric))) {
+                #Turn numeric data frames into matrices
+                data[[df[i]]] <- as.matrix(data[[df[i]]])
+            }
+            else {
+                stop("Data frame with non-numeric elements provided as data: ",
+                     names(data)[df[i]])
+            }
         }
     }
     else {