Search code examples
runicoderstudio

How to Encode Thai Characters in R


I have read in the text file using read.table.

group <- read.table("Sample_No2.txt", header = T, sep = ",", stringsAsFactors = F)

When I click on the group variable, it returns characters, which are not in English (It is in Thai language), in weird character (Below figure).

How do I make the software recognize the language ?

enter image description here

Thank you


Solution

  • you need to set locale to Thai in order to enable reading Thai alphabet

    Sys.setlocale(locale = "Thai")
    

    i hope this is an answer you were looking for as everyone else