Hi @quipmaster! It sounds like you want to filter your data before you plot it—that is, only keep rows that meet certain conditions (like being a given level of a factor). A really easy way to do this is with the filter function in dplyr:
library(dplyr) # you could also use library(tidyverse)
filtered_data <- Re_Space_wo2 %>% filter(
Remain %in% 2:4, # Remain is any of 2, 3 or 4...
Gender %in% 1:2, # AND Gender is any of 1 or 2...
NMI_SpacePump %in% 0:1) # AND NMI_SpacePump is any of 0 or 1
This code keeps rows that meet all three conditions (another way to express it would be to join the three conditions with ampersands instead of commas: Remain %in% 2:4 & Gender %in% 1:2, NMI_SpacePump %in% 0:1.
The other thing going on here that you might not see in other languages is %in%. It compares your data to many values, so it's a lot shorter and readable than Remain == 2 | Remain == 3 | …
If you'd actually like to keep rows that meet any of the three criteria, you can join conditions with a pipe:
filtered_data <- Re_Space_wo2 %>% filter(
Remain %in% 2:4 | # Remain is any of 2, 3 or 4...
Gender %in% 1:2 | # OR Gender is any of 1 or 2...
NMI_SpacePump %in% 0:1) # OR NMI_SpacePump is any of 0 or 1
Then just use filtered_data in ggplot2 in place of the original data. I hope that helps!