I am trying to plot 2 lines based on 2 variables using ggplot2 in R. Here is a piece from the complete Framingham data set that I am using:
df2 = read.table(text = " number smoker BMI sex
98 No 27.73 Men
99 No 24.35 Men
100 No 25.60 Men
101 Yes 24.33 Men
102 Yes 27.54 Men
299 No 24.62 Women
300 No 31.02 Women
301 Yes 21.68 Women
302 Yes 19.66 Women
303 Yes 26.64 Women", sep = "", header = TRUE)
I tried the following in ggplot and got a graph that I did not intend.
ggplot(df2, aes(smoker, BMI, color=sex)) + geom_line() + geom_point()
I want there to be two lines, one for Men and one for Women. I want the point in each of the smoker categories to represent the mean for that sex group.
Any idea how to do this using this data set? I found examples on stackoverflow that worked with other data sets.

facet_gridmight be helpful.