Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205343

Using ggplot2 facet grid to explore large dataset with continuous and categorical variables

$
0
0

I have a dataset with >1000 observations belonging to either group A or group B, and ~150 categorical and continuous variables. Small version below.

set.seed(16)
mydf <- data.frame(ID = 1:50, group = sample(c("A", "B"), 50, replace = TRUE), length = rnorm(n = 50, mean = 0, sd = 1), weight = runif(50, min=0, max=1), color = sample(c("red", "orange", "yellow", "green", "blue"), 50,  replace = TRUE), size = sample(c("big", "small"), 50, replace = TRUE))

I would like to visually compare group A and group B across each of the variables. To start I would like to make boxplot pairs showing A and B side by side for each continuous variable, and the same using bar plots for each categorical variable. Thinking that ggplot facet_grid would be ideal for this but not sure how to specify plot type according to data tyep, also not sure how to do this without specifying each variable one-by-one.

Interested in ggplot2 help and any alternative exploration techniques.


Viewing all articles
Browse latest Browse all 205343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>