diff histogram.r @ 2:001c5e3e5517 draft

Uploaded
author guerler
date Mon, 31 Mar 2014 17:22:25 -0400
parents
children 39ee947b4a9e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/histogram.r	Mon Mar 31 17:22:25 2014 -0400
@@ -0,0 +1,22 @@
+wrapper <- function(table, columns, options) {
+
+    # initialize output list
+    l <- list()
+
+    # loop through all columns
+    for (key in names(columns)) {
+        # load column data
+        column <- as.numeric(columns[key])
+        column_data <- sapply( table[column], as.numeric )
+
+        # create hist data
+        hist_data <- hist(column_data, plot=FALSE)#, breaks=seq(by=options$bin_size))
+
+        # collect vectors in list
+        l <- append(l, list(hist_data$breaks[2: length(hist_data$breaks)]))
+        l <- append(l, list(hist_data$density))
+    }
+
+    # return
+    return (l)
+}