How to read utf-8 encoded text in R

Donatas Kiznis picture Donatas Kiznis · Oct 21, 2016 · Viewed 13k times · Source

I'm importing .xlsx files in to R and when I enter print data command I get a mess with specific symbols. The file opens nicely with excel. This is the code I use:

library("xlsx") data <-read.xlsx("file.xlsx", sheetIndex = 1) print(data)

Answer

Christoph picture Christoph · Oct 21, 2016

I don't have access to your data so I cannot check:

data <- xlsx::read.xlsx("file.xlsx", sheetIndex = 1, encoding="UTF-8")