我是這個組中的新成員(也是一個相當新的R用戶),我有一個問題。我有這樣的data.table更改R中字段的名稱
Date V2 Deal Type
-----------------
1: 2009-1 Public sector bank Corporate Bond-Investment-Grade
2: 2009-1 Private sector bank Corporate Bond-Investment-Grade
3: 2009-7 Private sector industrial Corporate Bond-Investment-Grade
4: 2009-1 Private sector bank Corporate Bond-Investment-Grade
5: 2009-1 Private sector bank Covered Bond
6: 2009-1 Public sector bank Corporate Bond-Investment-Grade
7: 2009-1 Private sector bank Corporate Bond-Investment-Grade
問題是如何更改列V2中變量(和變量)的名稱。例如,我希望「公共部門銀行」和「私營部門銀行」在「財務」和「私營部門工業」和「公共部門工業」這個新專欄中出現爲「非金融」。希望我已經足夠清楚。非常感謝您的幫助。
的可能的複製http://stackoverflow.com/questions/7531868/how-to-rename-a-single-column-in -a-data-frame-in-r,http://stackoverflow.com/questions/5824173/replace-a-value-in-a-data-frame-based-on-a-conditional-if-statement-in -r等 –
使用包data.table時,我建議他們的offcial Cheat Sheet https://s3.amazonaws.com/assets.datacamp.com/img/blog/data+table+cheat+sheet.pdf – Berecht