调用vars时遇到“ expr:ncharline中的错误:无效的多字节字符串,元素1”

问题描述

每次调用vars()时,都会遇到“ expr:nchar(line)中的错误:无效的多字节字符串,元素1”。

当我发现此错误时,我试图从有关tidyevaluation(https://tidyeval.tidyverse.org/sec-why-how.html)的文档中复制一些示例。有关“无效的多字符串”的类似问题的几个答案将责任归咎于特殊字符。但是,在我的示例中没有使用特殊字符。

例如:

### The example from the document
vars(
  ends_with("color")
)
### simpler example
vars("a")

错误消息是:

> vars("a")
<list_of<quosure>>

[[1]]
<quosure>
expr: Error in nchar(line) : invalid multibyte string,element 1

由于我对 quosure nchar()缺乏了解,因此我对错误消息感到困惑。

如果不带任何参数调用vars(),则不会发生错误

> vars()
<list_of<quosure>>

named list()

以下是我的R sessionInfo:

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 
[2] LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

attached base packages:
[1] stats     graphics  Grdevices utils     datasets  methods  
[7] base     

loaded via a namespace (and not attached):
 [1] bit_4.0.4         compiler_4.0.3    R6_2.4.1         
 [4] magrittr_1.5      tools_4.0.3       torch_0.1.1      
 [7] Rcpp_1.0.5        bit64_4.0.5       torchvision_0.1.0
[10] rlang_0.4.8    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)