R:无法读取 Excel 中的所有工作表

R: Cannot Read All Worksheets in Excel

见下文 readxl::readxl_example() 我正在尝试复制:

path <- readxl::readxl_example("datasets.xls")
lapply(readxl::excel_sheets(path), readxl::read_excel, path=path)

以上显然有效,我基本上是在尝试为自己的作品重新创作,如下:

df2016<- readxl::read_excel("data_2016.xlsx")
lapply(readxl::excel_sheets(df2016), readxl::read_excel, df2016= df2016)

当我 运行 我的代码时,我 return 出现以下错误: 错误:path 必须是字符串

不要读取 excel,而是在 lapply 函数中提供位置。例如:

location <- "D:/data_2016.xlsx"
lapply(readxl::excel_sheets(location), readxl::read_excel, path=location)