A newbie in R. Considering this is my situation:(Actually my real situation is much more complex)
set.seed(100)
df = data.frame(SEX=sample(c("M","F"),100,replace=TRUE),BW = rnorm(100,80,2))
One column is SEX(male and female), another one is BW(body weight).
I want to test male's body weight normality and female's body weight normality. Then I can test equlity of variances respectively. At last, T test or other test for this situation.
But shapiro.test
can't be used in this situation. (like shapiro.test(BW~SEX,data=df)
)
What should I do? I don't want to seperate the data frame or make new subsets.
Thanks in advance~!