There are two problems. This first is that the following code gives "non-numeric argument to a mathematical function" error in the calculation of pchisq. The second is that I want to find the Mahalanobis distance between males and females and test to see if it was significantly different from zero.
dff1 = data.frame(score = c(91, 93, 72, 87, 86, 73, 68, 87, 78, 99, 95, 76, 84, 96, 76, 80, 83, 84, 73, 74),
hours = c(16, 6, 3, 1, 2, 3, 2, 5, 2, 5, 2, 3, 4, 3, 3, 3, 4, 3, 4, 4),
prep = c(3, 4, 0, 3, 4, 0, 1, 2, 1, 2, 3, 3, 3, 2, 2, 2, 3, 3, 2, 2),
grade = c(70, 88, 80, 83, 88, 84, 78, 94, 90, 93, 89, 82, 95, 94, 81, 93, 93, 90, 89, 89),
mf = c("m","f","f","m","m","m","f","m","m","f","f","f","m","f","f","m","m","f","f","f"))
dff1$maha1<-mahalanobis(dff1, colMeans(dff1), cov(dff1))
dff1$p <- pchisq(dff1$mahal, df=3.0, lower.tail=FALSE)