我需要生成一个矩阵作为自动图表创建过程的条件格式的输入。我的接收同事必须显示数字,并给每行的最大值和最小值一个相关的颜色。对于他的过程,第二个矩阵的条目表示行分钟和最大值将是理想的。 那我需要送什么
假设我有以下数据帧:
Cat Product Brand1 Brand2 Brand3
A a 6 9 5
A b 11 7 7
A c 9 5 5
B d 7 3 10
B e 5 8 8
B f 10 6 6
C g 8 4 4
C h 6 2 9
C i 4 7 7
由此,我想生成以下数据帧,其中“1”表示行最大值,“2”表示行最小值:
Cat Product Brand1 Brand2 Brand3
A a 0 1 2
A b 1 2 2
A c 1 2 2
B d 0 2 1
B e 2 1 1
B f 1 2 2
C g 1 2 2
C h 0 2 1
C i 2 1 1
指标“1”和“2”可以是其他的,甚至是字母或别的什么。零也可以是na
如何做到这一点
可以使用^{} 将值替换为^{} 创建的掩码:
另一种解决方案:
相关问题 更多 >
编程相关推荐