Tuesday, 13 August 2013

Histogram of binned data frame in R

Histogram of binned data frame in R

My (huge) dataframe coming from a python code is composed of counts in
different size classes for each sample as in :
dummy <- as.data.frame(matrix(nrow = 10, ncol = 12))
colnames(dummy) <- c("ID", paste("cl", c(1:11), sep = "."))
dummy$ID <- c(letters[1:10])
dummy[, -1] <- rep(round(abs(rnorm(11))*1000,0), 10)
I try to create histograms of the counts for each sample (ID) having size
classes on X axis and counts (frequencies) on Y axis. No success with
hist(), combining as.numeric() and t() and as.table() ...
I don't succeed in telling R that this data frame is (at least partly) a
table with counts already distributed in bins that are the colnames. I'm
sure I'm not the first guy looking for that but can't find the answer
since two days, maybe because I don't get the right keywords (?).
Can somebody help?

No comments:

Post a Comment