-1

I have a data frame (DF) that is structured like this :

RMS | measure | parameter | tirage | case | nombre

Here is the link to my data frame. I want to plot RMS as my y Vs. nombreas my x for different measure but for a specific value of parameter as well as a specific value of case. I have already tried this :

ggplot(data = DF, aes(factor(nombre), RMS, case = 2, parameter = 1)) +
geom_boxplot() +  
facet_wrap( ~ measure, scales = "fixed", ncol = 1) 

But it does not work. It still plots all data corresponding to all values of case and all values of measure. I searched a bit and I saw that if it was just one variable (either case or measure), I could simply use group = specific value. But since we have two variables, I don’t know how I should specify this. Your help would be greatly appreciated.

Basilique
  • 150
  • 1
  • 11
  • Can you include example data so we can reproduce your problem. You can use `dput` and paste your data into the question, or, better yet, rework your example to work with a builtin dataset like `mtcars` or `iris` – divibisan May 16 '19 at 19:27
  • 1
    Does this work: `ggplot(DT, aes(factor(nombre), RMS)) + geom_boxplot() + facet_wrap(~ measure + case + parameter)`? – pogibas May 16 '19 at 19:27
  • Maybe this: `subset(DF, case == 2 & parameter == 1)`? – pogibas May 16 '19 at 19:30
  • `library(dplyr); ggplot(data = DF %>% filter(case == 2, parameter == 1), aes(factor(nombre), RMS) ....` – Jon Spring May 16 '19 at 19:32
  • 1
    Please take the [tour](https://stackoverflow.com/tour) and read [How to ask](https://stackoverflow.com/help/how-to-ask). It will give you a badge and some useful knowledge. You should illustrate your specific problem in a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/reprex). I took a quick look at your questions and none of them had a reproducible example. You can read [how to make a reproducible example in R](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to learn what type of info your question should include. Cheers. – M-- May 16 '19 at 20:56
  • @Reyhaneh you did not. If you've actually bothered to scan through those links, you would've gotten the badge and known that a link to data is not fine. – M-- May 17 '19 at 13:01

1 Answers1

1
library(dplyr); library(ggplot2)
ggplot(data = DF %>% filter(case == 2, parameter == 1), 
       aes(factor(nombre), RMS)) +
geom_boxplot() +  
facet_wrap( ~ measure, scales = "fixed", ncol = 1) 
Jon Spring
  • 55,165
  • 4
  • 35
  • 53