更新时间:2023-02-09 20:40:38
我们可以使用 setNames
将列名替换为 sub
中的新列名./p>
We can use setNames
to replace the column names with the new column names from the sub
.
lapply(lst, function(x) setNames(x, sub("value.TCGA.", "", names(x))))
如果'value.TCGA',则另一个选项是 substring
.除第一个列名称外,所有列名称的位置均相同.
Or another option is substring
if the 'value.TCGA.' position is the same in all the column names except the first one.
lapply(lst, function(x) setNames(x, c("cpg", substring(names(x)[-1], 12)))