BEPAS 2.7 Boxplot + Factor vectors

One of the outcome variables in the BEPAS study is the moderate-to-vigorous physical activity which was measured using an accelerometer. This outcome variable is stored in the column MVPA_acc.

Use the boxplot() function to plot MVPA_acc by gender.
Try to obtain the boxplot below by creating a new factor variable (Gender) in the BEPAS dataset based on the original one (gender), but with different factor levels (see slides Session 2).

Alt text