R按列值子集行
示例
内置的功能子集可以rows与columns该满足的条件。
df <- data.frame(item = c(1:10),
price_Elasticity = c(-0.57667, 0.03205, -0.04904, 0.10342, 0.04029,
0.0742, 0.1669, 0.0313, 0.22204, 0.06158),
total_Margin = c(-145062, 98671, 20576, -56382, 207623, 43463, 1235,
34521, 146553, -74516))为了找到rows有price_Elasticity>0:
df[df$price_Elasticity>0,]
item price_Elasticity total_Margin 2 2 0.03205 98671 4 4 0.10342 -56382 5 5 0.04029 207623 6 6 0.07420 43463 7 7 0.16690 1235 8 8 0.03130 34521 9 9 0.22204 146553 10 10 0.06158 -74516
基于price_Elasticity>0和的子集total_Margin>0:
df[df$price_Elasticity>0&df$total_Margin>0,]
item price_Elasticity total_Margin 2 2 0.03205 98671 5 5 0.04029 207623 6 6 0.07420 43463 7 7 0.16690 1235 8 8 0.03130 34521 9 9 0.22204 146553
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短