Use Thai language in R

Post date: Jul 16, 2014 4:10:39 AM

I'm using RStudio as my main editor, and, by its default setting, we can type or even print out Thai characters there. This is great!

## Thai language in R ## เพิ่งรู้ว่าใช้ภาษาไทยใน R Studio ได้ text1 <- "งงว่ะ??" text2 <- "จิงเด่ะ" print(text1) myText <- paste(text1,text2,sep=' ') write(x=myText, file='Thai_name.txt')

We can also use Thai characters with other functions in the identical way as in English.

## We can also use Thai as a splitter or replacement text3 <- '<h2><a href="http://thaigoodname.com/กช/ดอกบัว.asp" style="color:#488809">กช</a></h2> <b> แปลว่า ดอกบัว </b> </div>' strsplit(x=text3, split="<|>") strsplit(x=text3, split="แปลว่า") strsplit(x=text3, split="<b>|<h2>")   gsub(pattern="แปลว่า" ,replacement = 'means', x=text3) gsub(pattern="แปลว่า" ,replacement ='คือ', x=text3)