I have a dataset with 3 columns. One is monthly expenditure (y-variable). Each value in this variable is categorised as either 1 or 0 under two different variables.
Data looks something like this:
df_UP.q234_month_exp df_UP.LFT df_UP.LF
1 NA 0 1
2 NA 1 1
3 12000 1 1
4 NA 1 1
5 20000 1 1
6 NA 0 1
Data has about 1200 rows.
I want a plot which creates a box plot for 'df_UP.q234_month_exp' as y-variable for all rows of 'df_UP.LFT' which are 1, and another box plot in the same plot with same y-variable, but for all rows of 'df_UP.LF' which are 1.
How to accomplish this using ggplot2?

ggplot(dat, aes(factor(f), var)) + geom_boxplot() + facet_wrap(.~g)wherefandgare your binary variables andvaryour numeric variable.