I以下のデータがあります。R:データ管理と行名
transaction <- c(1,2,3);
date <- c("2010-01-31","2010-02-28","2010-03-31");
type <- c("debit", "debit", "credit");
amount <- c(-500, -1000.97, 12500.81);
oldbalance <- c(5000, 4500, 17000.81)
evolution <- data.frame(transaction, date, type, amount, oldbalance, row.names=transaction, stringsAsFactors=FALSE);
evolution <- transform(evolution, newbalance = oldbalance + amount);
evolution
私はrow.names= transaction
を指定しても出力が得られます。
transaction date type amount oldbalance newbalance
1 1 2010-01-31 debit -500.00 5000.00 4500.00
2 2 2010-02-28 debit -1000.97 4500.00 3499.03
3 3 2010-03-31 credit 12500.81 17000.81 29501.62
問題がdate
の前に追加の数字1 to 3
ですフィールド。これを取り除く方法は?
アップデート:私は、出力は次のようになりたい:
transaction date type amount oldbalance newbalance
1 2010-01-31 debit -500.00 5000.00 4500.00
2 2010-02-28 debit -1000.97 4500.00 3499.03
3 2010-03-31 credit 12500.81 17000.81 29501.62
その値を含むtransaction
列です。
ありがとうございました。
計算しません。トランザクションは列であり、 'evolution [、-1]'で削除することができます。 –