将 .xlsx 文件读入 R

Mar*_*eet 3 r

我试图将一个 excel 文件读入 R。它是关于我的 cwd 中的以下文件:

 > list.files()
 [1] "Keuren_Op_Afspraak.xlsx"
Run Code Online (Sandbox Code Playgroud)

我安装了 XLConnect 并执行以下操作:

library(XLConnect)
demoExcelFile <- system.file("Keuren_Op_Afspraak.xlsx", package = "XLConnect")
wb <- loadWorkbook(demoExcelFile)
Run Code Online (Sandbox Code Playgroud)

但这给了我错误:

Error: FileNotFoundException (Java): File '' could not be found - you may specify to automatically create the file if not existing.
Run Code Online (Sandbox Code Playgroud)

但我不明白这是从哪里来的。有什么想法吗?

Ste*_*owe 5

我更喜欢使用 readxl 包。它是用 C 编写的,因此速度更快。它似乎也可以更好地处理大文件。命令将是:

library(readxl)
wb <- read_excel("Keuren_Op_Afspraak.xlsx")
Run Code Online (Sandbox Code Playgroud)