【发布时间】:2019-11-13 04:02:43
【问题描述】:
【问题讨论】:
【问题讨论】:
这些位于attribute of the data.frame columns called label which Rstudio visualises 中。在 R 中修改对象的许多操作都不会保留这些非必要属性,因此必须小心。
在您的示例中,您似乎想从 data.frame 中删除一些列。在保持标签完好无损的情况下完成此操作的一种方法是:
数据
df <- iris
attr(df$Species, "label") <- "This is the Species column"
现在删除一些列
df[c(1,2)] <- NULL
【讨论】:
x <- lapply(df, attr, "label") 但这是一个单独的问题