I am new to R, and I am trying to figure out a problem for a class I am taking. I have one numerical variable (Bwt) and a categorical variable (Sex). I can make a simple boxplot with Sex on the x axis and Bwt on the y axis: 
boxplot(Bwt ~ Sex)
What I need is to have Sex on the y axis and Bwt on the x axis, but it keeps saying it cannot because Sex is non-numerical (2 factors: M and F, in the dataset). 
I also tried using ggplot2, and geom_boxplot + coord_flip and it gives me NULL with no boxplot at all. I know this is probably really simple to do, but I just can't figure it out! Is there a way for R to read my categorical variable as numeric or just an easier way? Thanks so much!
 
     
    

