【发布时间】:2021-07-21 10:09:37
【问题描述】:
这是我的代码示例:
library(Rcpp)
library(readxl)
Sheets<-readxl::excel_sheets("~/data.xlsx")
sheet_names <- sheets[grepl("String", sheets, ignore.case=TRUE)
for (i in 1:length(sheet_names)){
dataset[i] <- read_excel("data.xlsx", sheet = sheet_names[i])
}
我想做的是返回一个名为“dataset1”的数据集,其中 i=1 和“dataset2”,其中 i=2,依此类推。或者,我想使用工作表本身的名称,即 sheet_names[i] 但是当尝试使用它时,它会覆盖变量中的字符串。
如果您对此提出任何建议,我将不胜感激。
【问题讨论】:
-
你试过了吗? dataset
-
我现在已经尝试过了,它很有魅力。非常感谢。