Q:

How to use Levene's test on a data frame in R

Say I have a data frame with two columns, height (in inches) and sex (Male or Female) and I want to run levene's test to see if the variance is the same for Male and Female height. How would I do this? 
I've read a few other questions here but none of them seem to address running a test from a data frame.

A:

It's actually very easy. Assuming your data is in data and the columns are height and sex:
# load leveneTest function
library(car)
# run the levene test centered around the mean
leveneTest(data$height, data$sex, center=mean)

