Renaming columns in a data frame - Cookbook for R

文章推薦指數: 80 %
投票人數:10人

Problem Youwanttorenamethecolumnsinadataframe. Solution Startwithasampledataframewiththreecolumns: dalphabetagamma #>1147 #>2258 #>3369 names(d) #>[1]"alpha""beta""gamma" Thesimplestwayistouserename()fromtheplyrpackage: library(plyr) rename(d,c("beta"="two","



請為這篇文章評分?