I am trying to create a personal project where I find a relationship between whether some Medicines caused any side effects. I have a file where there are 1000 subjects (553 males, 447 females) and indicated whether they took any medicines in buildup to any side effects experienced.
I filtered the dataset to get a shortened table of those who just took Medicine1, or Medicine2 or both. An example is this:
#### Filter Medicine1 Med1 <- survey %>% filter(Medicine1 == 'Yes')%>% filter(Medicine2 == 'No')%>% filter(Medicine3 == 'No')
Since I am looking for a relationship between medicines taken and propensity of side effects, the string type are not numbers, hence I cannot do a scatterplot. I decided to opt for a stacked bar graph (If you think this is the best approach or not, please let me know). Is it possible to incorporate 2 filtered (pipe-operated) dataset together or I would have to create bar graphs for each different filtered datasets?
Here is an example of the chart I made:
ggplot(data=Med1, aes(x = SideEffects, color = Gender))+ geom_bar()+ labs(title="Side Effects on Ingesting Medicine 1", caption= "Data Collected from Kaggle")