I want to use characters in multiple languages in "formula".
For example, I want to use Japanese, Chinese, and Korean, but if I use them at the same time, an error occurs.
If "locale" is specified as "Japanese", Japanese will not cause an error even if it is "formula", but Chinese and Korean will cause an error.
If "locale" is specified as "Chinese", Japanese and Chinese will not cause an error even if "formula", but Korean will cause an error.
How can I use characters from multiple languages in "formula" at the same time?
The code used is shown below.
Sys.setlocale(locale="Japanese")
as.formula("y ~ 测试") #Chinese
as.formula("y ~ テスト") #Japanese
as.formula('y ~ 테스트') #Korean
Sys.setlocale(locale="Chinese")
as.formula("y ~ 测试") #Chinese
as.formula("y ~ テスト") #Japanese
as.formula('y ~ 테스트') #Korean
The execution result is shown below.
> Sys.setlocale(locale="Japanese")
[1] "LC_COLLATE=Japanese_Japan.932;LC_CTYPE=Japanese_Japan.932;LC_MONETARY=Japanese_Japan.932;LC_NUMERIC=C;LC_TIME=Japanese_Japan.932"
> as.formula("y ~ 测试") #Chinese
Error in str2lang(x) : <text>:1:5: unexpected '<'
1: y ~ <
^
> as.formula("y ~ テスト") #Japanese
y ~ テスト
> as.formula('y ~ 테스트') #Korean
Error in str2lang(x) : <text>:1:5: unexpected '<'
1: y ~ <
^
>
> Sys.setlocale(locale="Chinese")
[1] "LC_COLLATE=Chinese (Simplified)_China.936;LC_CTYPE=Chinese (Simplified)_China.936;LC_MONETARY=Chinese (Simplified)_China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_China.936"
> as.formula("y ~ 测试") #Chinese
y ~ 测试
> as.formula("y ~ テスト") #Japanese
y ~ テスト
> as.formula('y ~ 테스트') #Korean
Error in str2lang(x) : <text>:1:5: unexpected '<'
1: y ~ <
^