yun hui chen
yun hui chen

Reputation: 1

read japanese character in R Studio

I have a japanese text csv file seperated by tab It was written in utf-8 using python csv package However,when i import it with command in RStudio as below

A <- read.csv("reviews4.csv",sep="\t",header = F,encoding="UTF-8")

The japanese character would show like this:

<U+8AAC>明無<U+3057><U+306B><U+5185>容量<U.....

I think it only shows kanji parts correctly.

I've tried encoding = "CP932" It would show: 隤祆<98><81><86>捆<87><....

Then I tried another way: click the file in the lower right and select "import dataset" Then strange things happend: When I choose "First rows as names",the colnames show japanese properly but when I disable that,it show uncorrectly.

enter image description here Can anyone help me importing japanese csv properly? Thank you so much!

Upvotes: 0

Views: 1956

Answers (1)

akky
akky

Reputation: 2907

Use fileEncoding="UTF-8" instead of encoding="UTF-8".

Upvotes: 2

Related Questions