Broken Korean in R

Asked 1 years ago, Updated 1 years ago, 119 views

Hi, everyone.

First of all, I'm spinning R on the server.

I've tried coding settings and other things after seeing the explanations related to Korean breaking, but I think I've never seen an error I'm experiencing before.

There is also an error when typing Korean in the script, for example, if you write 'hello', Hello, hello, hello, hello. Like this, the letters are attached and stretched.

And when you put the Korean explanation in the plot, the letters are broken in the way that English numbers appear in the square. Of course, I don't think it's a keyboard configuration error.

Please let me know if there is a solution to the error.

r korean

2022-09-22 14:10

1 Answers

After running R, did you run and try it as follows?

Sys.setlocale("LC_COLLATE", "ko_KR.UTF-8");

And I think the problem of font is that Hangul is broken when plotting. If you have a Korean font installed, try it as follows.

install.packages("extrafont")
library(extrafont) ## Don't forget to bring the package!
font_import() // Get all installed fonts

Also, when you print out the pdf as follows, you can specify the font type (e.g., Nanum Gothic). However, you must enter the font in English. I don't think it's going to be easy because of this.

cairo_pdf("Routput.pdf",family="Nanumgothic")


2022-09-22 14:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.