关闭。这个问题需要debugging details .它目前不接受答案。
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将帮助其他人回答问题。
5年前关闭。
Improve this question
假设我有一个名为 report.xlsx 的 excel 文件。该文件有 10 张,方便地命名为 Sheet1 到 Sheet10。在每张纸上,第 14 行有列标题:S/N、RegistryNr、Surname、FirstName、(空)、FatherName、MotherName、sex、(空)、DOB。如何将每张工作表合并到一个数据集中?
我知道 excel_sheets("report.xlsx")
我可以将所有工作表名称放入一个向量中。
我知道 df <- read_excel("report.xlsx", 1, skip = 14)
我可以将一张纸的所有数据放入数据框df。
这就是我对 R 的了解程度:/
如何结合上述命令将每张工作表导入同一个数据框中?
最佳答案
我通常使用 purrr 和 readxl 来执行此操作:
library(purrr)
library(readxl)
file <- 'path to report.xlsx'
sheets <- excel_sheets(file)
df <- map_df(sheets, ~ read_excel(file, sheet = .x, skip = 14))
关于r - 如何在 r 中合并多张 Excel 工作簿?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40550415/