changeset 12:9479e62342fa draft

Uploaded
author guerler
date Fri, 18 Apr 2014 16:40:58 -0400
parents 61a1d67f70d4
children e676c441d388
files histogram.r
diffstat 1 files changed, 2 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/histogram.r	Fri Apr 18 15:11:06 2014 -0400
+++ b/histogram.r	Fri Apr 18 16:40:58 2014 -0400
@@ -1,7 +1,3 @@
-# utilities
-roundUp <- function(x) 10 * ceiling(x/10)
-roundDown <- function(x) 10 * floor(x/10)
-
 # wrapper
 wrapper <- function(table, columns, options) {
 
@@ -20,12 +16,8 @@
     }
     
     # get min/max boundaries
+    min_value <- min(unlist(m))
     max_value <- max(unlist(m))
-    min_value <- min(unlist(m))
-    
-    # round number to base 10
-    min_value <- roundDown(min_value)
-    max_value <- roundUp(max_value)
     
     # check if single bin is enough
     if (min_value == max_value) {
@@ -37,7 +29,7 @@
     }
     
     # identify increment
-    increment <- roundUp((max_value - min_value) / 10)
+    increment <- (max_value - min_value) / 10
     
     # fix range and bins
     bin_seq = seq(min_value, max_value, by=increment)