Mercurial > repos > iuc > charts
diff histogram.r @ 1:344ac3ca7557 draft default tip
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/charts/ commit 4494db13b69987fbc97d47177d2a5956e46e927b"
author | iuc |
---|---|
date | Wed, 17 Nov 2021 09:06:59 +0000 |
parents | a87a3773d8ed |
children |
line wrap: on
line diff
--- a/histogram.r Fri Mar 09 08:23:08 2018 -0500 +++ b/histogram.r Wed Nov 17 09:06:59 2021 +0000 @@ -10,36 +10,36 @@ # load column data column <- as.numeric(columns[key]) column_data <- suppressWarnings(as.numeric(as.character(table[column][[1]]))) - + # collect vectors in list m <- append(m, list(column_data)) } - + # identify optimal breaks - hist_data <- hist(unlist(m), plot=FALSE) + hist_data <- hist(unlist(m), plot = FALSE) breaks <- hist_data$breaks; - + # add as first column l <- append(l, list(breaks[2: length(breaks)])) - + # loop through all columns for (key in seq(m)) { # load column data column_data <- m[[key]] - + # create hist data - hist_data <- hist(column_data, breaks=breaks, plot=FALSE) - + hist_data <- hist(column_data, breaks = breaks, plot = FALSE) + # normalize densities count_sum <- sum(hist_data$counts) if (count_sum > 0) { - hist_data$counts = hist_data$counts / count_sum + hist_data$counts <- hist_data$counts / count_sum } - + # collect vectors in list l <- append(l, list(hist_data$counts)) } - + # return - return (l) + return(l) }