I have a dataframe with test values of 20 different teststeps from some units (e.g. unit 1..5)
In addition I have 2 columns with lower and upper limit (ll and ul)
data <- data.frame(
ll=round(runif(20,5,15)),
ul=round(runif(20,80,95)),
unit1=sample(1:100,20,TRUE),
unit2=sample(1:100,20,TRUE),
unit3=sample(1:100,20,TRUE),
unit4=sample(1:100,20,TRUE),
unit5=sample(1:100,20,TRUE)
)
How do I get a count of values for each row which are below the lower limit (ll) and what count is above the upper limit (ul)?
Try this: