comparison histogram.r @ 9:656efffe650e draft

Uploaded
author guerler
date Fri, 18 Apr 2014 13:50:05 -0400
parents a889861139bc
children 86068f6de925
comparison
equal deleted inserted replaced
8:a889861139bc 9:656efffe650e
22 # get min/max boundaries 22 # get min/max boundaries
23 max_value <- max(unlist(m)) 23 max_value <- max(unlist(m))
24 min_value <- min(unlist(m)) 24 min_value <- min(unlist(m))
25 25
26 # round number to base 10 26 # round number to base 10
27 min_value <- roundUp(min_value) 27 min_value <- roundDown(min_value)
28 max_value <- roundUp(max_value) 28 max_value <- roundUp(max_value)
29 29
30 # check if single bin is enough
31 if (min_value == max_value) {
32 l <- append(l, max_value)
33 l <- append(l, 1.0)
34 return (l)
35 }
36
30 # identify increment 37 # identify increment
31 increment <- (max_value - min_value) / 10 38 increment <- roundUp((max_value - min_value) / 10)
32 39
33 # fix range and bins 40 # fix range and bins
34 bin_seq = seq(min_value, max_value, by=increment) 41 bin_seq = seq(min_value, max_value, by=increment)
35 42
36 # add as first column 43 # add as first column
37 l <- append(l, list(bin_seq[2: length(bin_seq)])) 44 l <- append(l, list(bin_seq[2: length(bin_seq)]))
38 45
39 # loop through all columns 46 # loop through all columns
40 for (key in seq(m)) { 47 for (key in seq(m)) {