dataframe - Histogram of binned data frame in R -


my (huge) dataframe coming python code composed of counts in different size classes each sample 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 create histograms of counts each sample (id) having size classes on x axis , counts (frequencies) on y axis. no success hist(), combining as.numeric() , t() , as.table() ...

i don't succeed in telling r data frame (at least partly) table counts distributed in bins colnames. i'm sure i'm not first guy looking can't find answer since 2 days, maybe because don't right keywords (?).

can help?

a histogram special kind of barplot. use function barplot.

i prefer package ggplot2 this:

#reshape long format library(reshape2)     dummy <- melt(dummy, id.var="id")  library(ggplot2)     p <- ggplot(dummy, aes(x=variable, y=value)) +    geom_histogram(stat="identity") +     #specifying stat_identity tells ggplot2 data binned   facet_wrap(~id, ncol=2)  print(p) 

enter image description here


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -