我有一个如下所示的数据集:
ID Assignment Sex Age_0_34 Age_35_45
1 MBT F 0% 0%
1 MBT F 0% 0%
2 MBT F 0% 2.5%
2 MBT F 0% 0%
3 MBT F 1.5% 0%
3 MBT F 0% 0%
4 MBT F 0% 0%
4 MBT F 0% 1.2%
我希望最后一列之后的内容是这样的:
ID Assignment Sex Age_0_34 Age_35_45 Age
1 MBT F 2.0% 0% Age_0_34
1 MBT F 0% 5.0% Age_35_45
2 MBT F 0% 2.5% Age_35_45
2 MBT F 0% 0% 0
3 MBT F 1.5% 0% Age_0_34
3 MBT F 0% 0% 0
4 MBT F 3.5% 0% Age_0_34
4 MBT F 0% 1.2% Age_35_45
所以基本上我想做的是创建一个值大于 1% 的列,并在该行旁边的最后一列中显示列名