Open Shicheng-Guo opened 3 years ago
How to solve this issue - detect non ascii characters in a string in devtools::check(--as-cran)?
the solution is to use grepl("[^ -~]", x) to find non-ASCII and then use stri_enc_toascii convert to ASCII
grepl("[^ -~]", x)
stri_enc_toascii
xx<-unlist(apply(impc,2,function(x) any(grepl("[^ -~]", x)))) which(xx) library("stringi") impc[,19]<-stri_enc_toascii(impc[,19]) usethis::use_data(impc,overwrite = T)
How to solve this issue - detect non ascii characters in a string in devtools::check(--as-cran)?
the solution is to use
grepl("[^ -~]", x)
to find non-ASCII and then usestri_enc_toascii
convert to ASCII