The solution of reading garbled code in RStudio Chinese in R language
In this issue, the editor will bring you solutions to read garbled codes in RStudio in R language. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.
When using rjson package to read and process json data in RStudio, the Chinese will be displayed as "" and other similar garbled codes.
The solution can be solved perfectly by entering the following command in the R language terminal.
Sys.setlocale (category= "LC_ALL", locale= "en_US.UTF-8")
Save the following JSON data to a file in json format (note that the file is encoded as UTF-8)
{"ID": ["1", "2", "3", "4", "5", "6", "7", "8"], "Name": ["Rick", "Dan", "Michelle", "Ryan", "Gary", "Nina", "Simon", "Guru"], "Salary": ["623.3", "515.2", "611,729", "843.25" "578", "632.8", "722.5"], "StartDate": ["1xpr 1x2012", "923pr 2013", "11xpr 2014", "5pr 11pr 2014", "3xpx 27px 2015"," 5xpx 21,000pr 2013 "," 7xpxp2013 "," 617plp2014 "]," Dept ": [" IT Department "," Operations "," IT "," HR Human Resources " "Finance", "IT", "Operations", "Finance"]}
Using the rjson package to read json data, the following three lines of command have been issued:
Library ("rjson") result_json