0

I want to calculate the percent of my data below a cutoff value. For example, in the following data, I would like to calculate the percentage of 'measurements' less than or equal to 13.

id <- c(3,3,6,6,4,4,3,3)
measurement <- c(10, 13, 14,13, 12, 11, 14, 17)
myData <- data.frame(id, measurement)
myData
PriyamK
  • 141
  • 10

1 Answers1

0

You can try this:

id <- c(3,3,6,6,4,4,3,3)
measurement <- c(10, 13, 14,13, 12, 11, 14, 17)
myData <- data.frame(id, measurement)
myData
mean(myData$measurement<=13)

Output:

[1] 0.625
Duck
  • 39,058
  • 13
  • 42
  • 84