2

我正在尝试使用 Openxlsx 库将 Excel 文件中的数据导入 R:

library(openxlsx)
data <- read.xlsx("datafile.xlsx", sheet = "Sheet1")

但是,我收到以下错误:

Error in file(con, "r") : invalid 'description' argument
In addition: Warning message:
In unzip(xlsxFile, exdir = xmlDir) : error 1 in extracting from zip file
4

2 回答 2

0

我认为解决此问题的最佳方法是重置数据源的路径。请不要在您的路径中包含任何没有英语的字符。

setwd("C:\\Users\\your path way (where you store datafile.xlsx)")

PS Rstudio2021 似乎对非英语用户不友好☺☺☺</p>

于 2022-02-14T13:18:28.817 回答
0

抛出此错误是因为您的 Excel 文件已打开。保存并关闭 Excel 文件,然后重试,它将起作用。

于 2021-03-09T09:11:42.783 回答