晚上好於R總計數據,分組和基於兩組
我有這個樣子
FY Type Total
2014 State $5,000
2014 Federal $2,596
2014 State $5,123
2014 Federal $2,567
2013 State $5,555
2013 Federal $2,784
2013 State $5,562
2013 Federal $2,556
我如何將能夠通過兩個財政年度獲得總計和鍵入R數據?
因此,它可以看起來像:
FY Type Total
2013 Federal $5,340
2013 State $11,117
2014 Federal $5,163
2014 State $10,123
謝謝! 我不確定我是否理解你在說什麼。轉換爲數字?總數在R中是數字。你能稍微打破這兩個步驟嗎? –
'$ 5,000'不是R中的一個數字。它有一個'$'和',',因此,不是一個數字。 – thelatemail
http://stackoverflow.com/questions/1660124/how-to-sum-a-variable-by-group – akrun