简体   繁体   English

在RStudio中寻址数据框中的列时出现gsub错误消息

[英]gsub error message when addressing column in dataframe in RStudio

Since a couple of days I get the following error message in RStudio from time to time and can't figure out what is causing it. 几天以来,我不时在RStudio中收到以下错误消息,无法弄清楚是什么原因引起的。

When I write in the console window to address a data.frame followed by $ to address a specific column in the data.frame (for example df$SomeVariable ), the following message is shown in the console window and is printed over an over with every letter I type 当我在控制台窗口中写地址data.frame,然后用$寻址data.frame中的特定列(例如df$SomeVariable )时,以下消息显示在控制台窗口中,并打印在上方我输入的每个字母

Error in gsub(reStrip, "", completions, perl = TRUE) :
 input string 38 is invalid UTF-8

The error message doesn't have any real effect. 该错误消息没有任何实际效果。 Everything works just fine except the automatic completion of the variable name. 除了自动完成变量名之外,其他一切都很好。 I'm using R version 3.4.4 and RStudio Version 1.0.143 on a Windows computer. 我在Windows计算机上使用R版本3.4.4和RStudio版本1.0.143。 In the R script I am currently working on I don't use gsub or any other "string" or regular expression function for that matter. 在当前正在使用的R脚本中,我不使用gsub或任何其他“字符串”或正则表达式函数。 The issue appeared with various data.frames and various types of variables in the data.frames (numeric, integer, date, factor, etc.). 该问题出现在各种data.frames和data.frames中的各种类型的变量(数字,整数,日期,因子等)上。 It also happens with various packages. 各种程序包也会发生这种情况。 Currently, I am using combinations of the packages readr, dplyr, plm, lfe, readstata13, infuser, and RPostgres. 当前,我正在使用以下软件包的组合:readr,dplyr,plm,lfe,readstata13,infuser和RPostgres。 The issue disappears for a while after closing RStudio and opening it again but re-appears after working for a while. 关闭RStudio并再次打开它后,问题消失了一段时间,但工作了一段时间后,问题再次出现。

Does anyone have an idea what may cause this and how to fix it? 有谁知道这可能是什么原因以及如何解决?

I used to have the same problem a few days ago. 我以前几天也遇到过同样的问题。 I made some research and i found that when you import the dataset, you can change the encoding. 我进行了一些研究,发现导入数据集时可以更改编码。 Change the encoding to "latin1" and maybe that could fix your problem. 将编码更改为“ latin1”,也许可以解决您的问题。 Sorry for my poor english, im from Southamerica. 对不起,我的英语不好,我来自南美。 Hope it works. 希望它能工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM