-1
使用該數據分組總和正值和負值:其他值
Respon Type Value
Mark -1 2
Mark -2 4
Sheyla 1 10
Ana 1 4
Sheyla 2 3
Mark 1 4
Ana -2 6
Ana 2 7
我想獲得一個名爲取決於類型「積極」和「消極」至極資金正值和負值,並通過分組兩列Respon
Respon Positive Negative
Mark 4 6
Sheyla 13 0
Ana 11 6
謝謝你在前進,
in base R:'reshape(aggregate(Value_Response + sign(Type),df,FUN =「sum」),idvar =「Respon」,timevar =「sign(Type)」,direction = 「寬」)' –