R
is vectorized and R
recycles. That means, that generally, something as simple as myDF > threshold
will get you awfully close to what you need.
Specifically, it will give you a logical matrix
of the same dimensions as your data.frame
which will be TRUE
when that cell in the DF exceeds the threshold (and FALSE
otherwise).
You can then use that matrix as your tool to subset the data.frame.
myDF[myDF > threshold]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…