2

Some of my students got an issue yesterday. I tried to solve it with some code examples from Stackoverflow, but none of them worked for me.

I tried to import an .xlsx file and some of the characters like "ΓΌ" got replaced by "". It seems that this is an encoding problem, so I tried the following:

library(rio)    
df <- import("example.xlsx",encoding = "UTF-8", na="...")

R throws back this error:

unused argument (encoding = "UTF-8 ")

I have to use the Rio package! So does anybody has a solution for my problem? It seems that this problem mostly appears on Mac computers with OSX.

I really appreciate your help, thanks a lot!

zx8754
  • 52,746
  • 12
  • 114
  • 209
Lars
  • 132
  • 9
  • 2
    `rio::import()` (no captial I) just calls `readxl::read_excel()` for xlsx files. This is `read_excel()`'s signature: `read_excel(path, sheet = NULL, range = NULL, col_names = TRUE, col_types = NULL, na = "", trim_ws = TRUE, skip = 0, n_max = Inf, guess_max = min(1000, n_max))`. It has no `encoding` parameter. Take a look at https://github.com/tidyverse/readxl/issues/125 which was found via a search for `r read_excel utf-8` – hrbrmstr Nov 10 '18 at 14:26
  • Yes i know the `read_excel` function, but i didn't know that the `import` function just calls it. I will use this then, thank you. – Lars Nov 11 '18 at 10:43
  • look at the R manual page for `import`. it lists all the functions that it dispatches the actual work to depending on file format. – hrbrmstr Nov 11 '18 at 10:48

0 Answers0