diff(range) of one variable for specific values of a different variable

14 Views Asked by At

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!

0

There are 0 best solutions below