I am trying to read an excel file that has some companies data in R, companies names are in persian but when I read the files into R, the companies names don't readable, I'm trying this code to read my data
read.csv("book.csv",encoding = "UTF-8")
First you must create a CSV correct file with Persian characters. Because if you save as your Excel to CSV format your file will changed in incorrect characters. So for this, you can use Google doc spreadsheet. Import or copy your Excel table in Google doc new spreadsheet and then download in CSV format. Open your CSV file with Notepad and save as with UTF-8 format. Now you can use this CSV file.
Before reading into R, open the file with notepad++, and go to Encoding -> convert to UTF-8, and save.
Then, read into R with read_csv
from the readr
package, rather than read.csv
.
This should solve it.
I finally found the answer. By setting the system locale as persian one can add persian columns into R.
Sys.setlocale(locale = "persian")**
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.