# HG changeset patch # User guerler # Date 1397853658 14400 # Node ID 9479e62342fae25ea153d815ae45e50e39ef3460 # Parent 61a1d67f70d4687a6db0db3ae2d96c4325fc7f8c Uploaded diff -r 61a1d67f70d4 -r 9479e62342fa histogram.r --- 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)