I am trying to create a scatterplot in rstudio that has data comparing snout-vent length and the bite force of anoles and then have two lines that represent Male data and then Female data. I have been unable to seperate the data between the different sexes.
to create the plot I used this code:
Plot(BF~SVL, data=BiteF) to get the lines I have been trying to use the abline() function and also using the m1 <- lm() but can't find how to make one for males and one for females and everything online does not work or does not make sense.
part of the data for this looks like this:
BF: 0.72 NA 0.2 0.33 1.38 1.69 0.6 0.3 NA -0.18 -0.03 1.18 SVL: 1.85 1.53 1.64 1.59 2.09 2.17 1.65 1.74 1.51 1.60 1.50 2.05 Sex: M M M M M M M F F F F F
The BF data does also have some missing values that I have't figured out how to remove yet aswell. And I attached the plot I am supposed to mimic.
m1 <- lm(BF~SVL+Sex,
-
data=BiteF, -
(df[df$Sex == 'M']))
m1 <- lm(BF~SVL+Sex(df[df$Sex == 'M'],
-
data=BiteF))
df <- data.frame(BiteF$Sex c('M','F'))
these are some of the lines of code I have tried from searching online and none of it has worked