RStudio - no symbol named 'X' in scope

本小妞迷上赌 提交于 2021-02-04 18:17:32

问题


Why do I get the yellow triangular warnings in the LHS margin in RStudio when using packages like dplyr? When I begin to use my current version of RStudio (1.0.136) there are no warnings. Then I start to code, mistype something, and a whole bunch of the yellow triangles appear. Yet if I restart RStudio, I begin again with none.

Is there a way to suppress and/or prevent this?


回答1:


Those are code diagnostics, designed to help you catch errors and fix them. You can turn them off if they are annoying and cumbersome.

Here is a link that discusses these features of the IDE and how to change them:

https://support.rstudio.com/hc/en-us/articles/205753617-Code-Diagnostics

Justin




回答2:


Please try to execute that function associated with variable outside explicitely so that one global variable will be generated named "site_os_id".

hist( AGE, col = " Dark Grey")

while executing above statement I got error as "No symbol named AGE in scope". Then I executed this statement AGE <- hc$AGE and then again same above query works.




回答3:


To get rid of the warnings, you can trick RStudio as follows:

# Source and define variables to prevent code diagnostic warnings
source("the_other_script.R")

if (FALSE) {
  variable1 <- NULL
  variable2 <- NULL
  # etc.
}


来源:https://stackoverflow.com/questions/44835528/rstudio-no-symbol-named-x-in-scope

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!