立即学习:https://edu.csdn.net/course/play/24913/285758?utm_source=blogtoedu
which函数
返回向量中为TRUE的元素位置
a = sample(1:100, 10)
a
median(a)
which(median(a) < a)
a[which(median(a) < a)]
对应结果:
[1] 63 24 90 87 71 1 54 6 37 53
[1] 53.5
[1] 1 3 4 5 7
[1] 63 90 87 71 54