My problem is as follows: I wont calculate the difference between Max value and Min value of BMI variable depending by sex (sesso) variable.
I write this code in R but' don't work
tapply(S1_Dataset_red$Bmi, INDEX = (S1_Dataset_red$Sesso), diff(range), na.rm=TRUE)
The error is: Error in x[0L] : object of type 'builtin' is not subsettable.
I need your help!