comparison histogram.r @ 33:39ee947b4a9e draft

Uploaded
author guerler
date Mon, 07 Apr 2014 19:24:19 -0400
parents 001c5e3e5517
children
comparison
equal deleted inserted replaced
32:e915224afc1d 33:39ee947b4a9e
8 # load column data 8 # load column data
9 column <- as.numeric(columns[key]) 9 column <- as.numeric(columns[key])
10 column_data <- sapply( table[column], as.numeric ) 10 column_data <- sapply( table[column], as.numeric )
11 11
12 # create hist data 12 # create hist data
13 hist_data <- hist(column_data, plot=FALSE)#, breaks=seq(by=options$bin_size)) 13 hist_data <- hist(column_data, plot=FALSE)
14 14
15 # collect vectors in list 15 # collect vectors in list
16 l <- append(l, list(hist_data$breaks[2: length(hist_data$breaks)])) 16 l <- append(l, list(hist_data$breaks[2: length(hist_data$breaks)]))
17 l <- append(l, list(hist_data$density)) 17 l <- append(l, list(hist_data$density))
18 } 18 }
19
20 # make sure length is fine
21 n <- max(sapply(l, length))
22 ll <- lapply(l, function(X) {
23 c(as.character(X), rep("", times = n - length(X)))
24 })
25 l <- do.call(cbind, ll)
19 26
20 # return 27 # return
21 return (l) 28 return (l)
22 } 29 }