Persistent warnings from earlier commands with RStudio

RRstudio

R Problem Overview


I'm struggling to create a reproducible example for this, but I suspect others will know what I mean. Why does R sometimes seem to get stuck with a backlog of warnings/error messages that it repeats again after subsequent commands? E.g. you get some warning message Bad whatever system choking after running some code, which repeats again after you enter an innocuous instruction like x <- 5. This sometimes happens after several entries of x <- 5, although it normally stops after one or two.

R has been like this for me for at least 5 years, across many versions on both Windows and Mac. Am I alone? Does anyone know if it has been identified as a bug? I normally work with RStudio so I wonder if it's related to the IDE.


Edit. Pretty sure this is related to RStudio.

R Solutions


Solution 1 - R

Answer by zeehio.

This is an issue with the Diagnostics tool in RStudio (the tool that shows warnings and possible mistakes in your code). It was partially fixed at this commit in RStudio v1.1.103 or later by @kevin-ushey. That fix was partial, because the warnings still appeared (albeit with less frequency). This issue was reported with a reproducible example at https://github.com/rstudio/rstudio/issues/7372 and it was fixed on RStudio v1.4 pull request.

The warnings appear because the diagnostics tool in RStudio parses the source code to detect errors and when it performs the diagnostic checks it accesses columns in your tibble that are not initialized, giving the Warning we see. The warnings do not appear because you run unrelated things, they appear when the RStudio diagnostics are executed (when a file is saved, then modified, when you run something...).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiongeotheoryView Question on Stackoverflow
Solution 1 - RArtemView Answer on Stackoverflow