Donatas Kiznis Donatas Kiznis - 1 month ago 16
R Question

How to read utf-8 encoded text in R

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

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

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