根据其他列中的二进制值创建新的条件列? (R)

时间:2019-03-04 21:55:11

标签: r

我的数据如下:

A   B   C
1   0   0
0   1   0
0   1   0
0   0   1

这就是我要去的地方:

A   B   C   New_Column
1   0   0   A
0   1   0   B
0   1   0   B
0   0   1   C

因此,我正在创建一个新列,该列告诉我三个变量(A,B或C)中的哪个存在。三列中只有一列每行包含1。最好的方法是什么?

1 个答案:

答案 0 :(得分:1)

我们可以使用#include <string> #include <iostream> std::string const newLineWithIndent = "\n "; int main() { std::cout << " hello" << newLineWithIndent << "400"; }

max.col
相关问题