So I need to create a plots (ggplot
) of multiple histograms for each cross sectional units.
Lets say that we have a data.frame of correlation of all independent variables (to dependent variable) and we need to visualize as histogram, multiple histograms, using probably facet_wrap
or similar.
I know how to perform it with one variable:ggplot(DATA, aes(A)) + geom_histogram()
but I would like to see all variables (A, B, C, ...) in one single plot NOT mechanically creating all plot and then using grid.arrange
is preferred for me since I we can have a datasets with even more of variables.
sample dataset:
unit <- c(1:100)A <- c(runif(100,-1,1))B <- c(runif(100,-1,1))C <- c(runif(100,-1,1))D <- c(runif(100,-1,1))E <- c(runif(100,-1,1))F <- c(runif(100,-1,1))DATA <- data.frame(unit, A, B, C, D, E, F)