Forum Discussion

Eliza1994's avatar
Eliza1994
Regular Visitor
4 years ago
Solved

How to change the font( language) with R Visuals(library qcc)

Anyone kindly help me to figure out how to change the font(language) into Japanese with R Visuals?

 

I am a Power BI user in Japan and trying to draw a fishbone visual with R(qcc).

I find the script below and draw a fishbone diagram successfully.

-------------------------------------------------------------------------------------------------

install.packages(qcc)
library(qcc)
cause.and.effect(cause=list(Measurements=c("Micrometers","Micrometers","Inspectors"),
Materials=c("Alloys","Lubricants","Suppliers"),
Environment=c("Condensation","Moisture"),
Methods=c("Brake","Engager","Angle"),
Machines=c("Speed","Bits","Sockets")),
effect = "Surface Flaws")

-------------------------------------------------------------------------------------------------

However, once I changed the contents into Japanese, the visual failed to show a result.

library(qcc)
cause.and.effect(cause=list(軸の素材=c("仕入先変更"),
作業者=c("作業者ミス","トレーニング充実度"),
加工過程=c("最大ワークロード超えた","挽回生産予定数多い"),
設備=c("経年劣化","メンテナンス不足")),
effect = "軸受け破損")
 
Is there any way to draw the diagram in Japanese?
Any help is appreciated.
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Eliza1994 ,

     

    It looks like R has a hard time reading in non-English characters in as text.

    Maybe these options can help you :

    1. In RStudio, try going in Tool > Global Options > Code > Saving > and then choose the right encoding for Japanese and Mandarin. The UTF-8 enconding might work for you.
    2. The blog post Escaping from character encoding hell in R on Windows explains how to set the encoding to import external documents. It should work with data imported with RODBC as well. The autor uses Japanese characters in his examples.
    3. In the odbcDriverConnect() function of the RODBC package, the argument DBMSencoding="UTF-8" might work for you.
    4. To have the correct characters, you may need to specify the encoding: readLines(url, encoding="UTF-8")

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Eliza1994 ,

     

    It looks like R has a hard time reading in non-English characters in as text.

    Maybe these options can help you :

    1. In RStudio, try going in Tool > Global Options > Code > Saving > and then choose the right encoding for Japanese and Mandarin. The UTF-8 enconding might work for you.
    2. The blog post Escaping from character encoding hell in R on Windows explains how to set the encoding to import external documents. It should work with data imported with RODBC as well. The autor uses Japanese characters in his examples.
    3. In the odbcDriverConnect() function of the RODBC package, the argument DBMSencoding="UTF-8" might work for you.
    4. To have the correct characters, you may need to specify the encoding: readLines(url, encoding="UTF-8")

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.