-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random stuff on encoding #1
Comments
@ChrisMuir many thanks! I've already known the While R encoding is a complex problem. Your code I will add more examples to solve the Chinese Encoding problems when I am not busy. BTW, I find your > Sys.getlocale()
[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"
> l10n_info()
$`MBCS`
[1] TRUE
$`UTF-8`
[1] FALSE
$`Latin-1`
[1] FALSE
$codepage
[1] 936
> Sys.localeconv()
decimal_point thousands_sep grouping int_curr_symbol currency_symbol
"." "" "" "CNY" "¥"
mon_decimal_point mon_thousands_sep mon_grouping positive_sign negative_sign
"." "," "\003" "" "-"
int_frac_digits frac_digits p_cs_precedes p_sep_by_space n_cs_precedes
"2" "2" "1" "0" "1"
n_sep_by_space p_sign_posn n_sign_posn
"0" "4" "4" |
Hi Bruce, thanks for the reply! Yeah I should have mentioned that both of my code examples are specific to an English local. Ah, I've never used lbs amap, that's cool. I use the Baidu Maps API (via baidumap R package), for situations in which the Cheers! |
Just came across this repo, it's 👍
I work with Chinese data in R and Python, and have struggled often with encoding issues in R, so figured I'd share some of the things I've come across and learned in the process. Most of the stuff below is related to file system functions and identifying files. Feel free to add any of this to the repo if you'd like (or not, it's all good).
list.files()
versusSys.glob()
list.files()
fails at preserving Chinese chars, useSys.glob()
instead. Here's an example:Issue with Chinese Parenthesis Chars in File Names
Package
fs
The fs package is great, there's been a few times where it's been able to ID a file on my PC for which base functions have failed. I often use
fs::is_file()
in place ofbase::file.exists()
, andfs::file_copy()
in place ofbase::file.copy()
.This Kevin Ushey Blog Post
This blog post by Kevin Ushey on string encoding in R is fantastic (and the comments are full of info as well).
System Info
And here's my system/local info
The text was updated successfully, but these errors were encountered: