【发布时间】:2020-08-04 12:40:51
【问题描述】:
我正在从一个列表中绘制 7 个直方图,并希望根据列表的位置更新直方图的标题。
这是我目前得到的,但在执行脚本时出现以下错误。
item_df[df] 中的错误:无效的下标类型“列表”
full_df <- read.csv("filename")
item_df <- split(full_df, full_df$PIA_ITEM)
par(mfrow = c(3,3)) # 3 rows and 3 columns
for (df in item_df) {
hist(df[[7]], breaks=9, main = paste("Histogram of", names(item_df[df])))
}
错误点在于我尝试使用循环索引来绘制列表名称位置
main = paste("Histogram of", names(item_df[df]))
【问题讨论】: