在 R 中读取包含一些工作表的 Excel 文件夹
我有一个包含 Excel 文件的文件夹。有些有工作表,我只是想知道如何使用特殊情况(可能是 for 循环),在其中我将确定需要使用哪些文件来读取工作表,然后仅选择某些选项卡来加入所有 Excel 文件最后在一起。此外,这些选项卡需要跳过 40 行,我假设将使用skip=40。当我输入我拥有的代码时,它看起来像一团糟。
files <- list.files(path = "/Users/Desktop/folder2, pattern = "*.xlsx")
files_join <- lapply(files, read_excel) %>%
bind_rows()
I have a folder containing excel files. There are some that have worksheets and I just want to know how to use a special case (maybe a for loop) where I would identify which files need to be used to read worksheets and then select only certain tabs to join all of the excel files together at the end. In addition, these tabs would need to skip 40 lines which I assume would use skip=40. When I type the code that I have, it looks like a giant mess.
files <- list.files(path = "/Users/Desktop/folder2, pattern = "*.xlsx")
files_join <- lapply(files, read_excel) %>%
bind_rows()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论