9

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)

Donatas Kiznis
  • 127
  • 1
  • 1
  • 5
  • 1
    See `encoding` part here: https://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html – Marta Oct 21 '16 at 11:55
  • 1
    "importing .xlsx files in to R" - please show us the code. Maybe duplicate of [this](http://stackoverflow.com/questions/23879521/how-can-i-read-utf-8-text-file-in-r) ? – zx8754 Oct 21 '16 at 12:01
  • Possible duplicate of [how to read data in utf-8 format in R?](http://stackoverflow.com/questions/22876746/how-to-read-data-in-utf-8-format-in-r) – Enrique Oct 21 '16 at 12:04
  • Which package are you using for the data extraction? you can't just `read.csv()` an Excel file. You need to use one of the half-dozen or so Excel pkgs to actually get Excel data into R. – hrbrmstr Oct 21 '16 at 12:14

1 Answers1

14

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

data <- xlsx::read.xlsx("file.xlsx", sheetIndex = 1, encoding="UTF-8")
Christoph
  • 6,841
  • 4
  • 37
  • 89