Why can't I rename a data frame column inside a list?

Posted by Moreno Garcia on Stack Overflow See other posts from Stack Overflow or by Moreno Garcia
Published on 2014-06-03T00:29:45Z Indexed on 2014/06/03 9:25 UTC
Read the original article Hit count: 181

Filed under:
|
|

I would like to rename some columns from CPU_Usage to the process name before I merge the dataframes in order to make it more legible.

names(byProcess[[1]])
# [1] "Time"      "CPU_Usage"
names(byProcess[1])
# [1] "CcmExec_3344"
names(byProcess[[1]][2]) <- names(byProcess[1])
names(byProcess[[1]][2])
# [1] "CPU_Usage"
names(byProcess[[1]][2]) <- 'test'
names(byProcess[[1]][2])
# [1] "CPU_Usage"
lapply(byProcess, names)
# $CcmExec_3344
# [1] "Time"      "CPU_Usage"
#
# ... (removed several entries to make it more readable)
#
# $wrapper_1604
# [1] "Time"      "CPU_Usage"

© Stack Overflow or respective owner

Related posts about list

Related posts about dataframes