Skalwalker
Skalwalker

Reputation: 309

R failed to open xls on macOS

I am trying to read a .xls file using the read_xls function, but always give me a "failed to open" message. I think there is an issue on my R or on my environment setup, because for every way I tried, I asked for a friend to do exactly the same, with the same file, in his machine. I tried running the code from both the R Shell and the RStudio, still gives me the error message.

library(readxl)
test <- read_xls("unb-dgp.xls", sheet=1, col_names = TRUE, col_types = NULL, skip=0)

Error in read_fun(path = path, sheet_i = sheet, limits = limits, shim = shim,  : 
  Failed to open unb-dgp.xls

My only guess of what might be causing a problem, is that I am running in a macOS.

Upvotes: 1

Views: 1248

Answers (1)

WANNISA RITMAHAN
WANNISA RITMAHAN

Reputation: 391

You may check this out https://github.com/tidyverse/readxl/issues/373. I also experienced the similar problem and I notice that not all columns' names are assigned. When I executed readxl::read_xls(file) on the different .xls file, it worked so, it is not the problem from this package and likely due to the file itself. Alternatively, trying read.table on the problem file also worked well.

Upvotes: 1

Related Questions