我正在尝试更改数据框中列的编码。
stri_enc_mark(data_updated$text)
# [1] "UTF-8" "ASCII" "ASCII" "UTF-8" "ASCII" "ASCII" "UTF-8" "UTF-8" "UTF-8"
# [10] "ASCII" "ASCII" "UTF-8" "ASCII" "UTF-8" "ASCII" "UTF-8" "ASCII" "UTF-8"
# [19] "ASCII" "UTF-8" "ASCII" "UTF-8" "ASCII" "UTF-8" "UTF-8" "ASCII" "ASCII"
# [28] "ASCII" "ASCII" "UTF-8" "ASCII" "ASCII" "ASCII" "UTF-8" "UTF-8" "ASCII"
Run Code Online (Sandbox Code Playgroud)
当我尝试转换它时,它不会抛出错误,但仍然对向量没有影响:
d <- enc2utf8(data_updated$text)
stri_enc_mark(d)
# [1] "UTF-8" "ASCII" "ASCII" "UTF-8" "ASCII" "ASCII" "UTF-8" "UTF-8" "UTF-8"
# [10] "ASCII" "ASCII" "UTF-8" "ASCII" "UTF-8" "ASCII" "UTF-8" "ASCII" "UTF-8"
# [19] "ASCII" "UTF-8" "ASCII" "UTF-8" "ASCII" …Run Code Online (Sandbox Code Playgroud)