Why can't I rename a data frame column inside a list?
- by Moreno Garcia
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"