skip to Main Content

Example I use R in Visual studio code and see some blue underlines in all print functions. What does it mean?

I tried to add some more spaces, cause it helped to avoid blue underlines in other parts of the code, but it doesn’t help.

2

Answers


  1. I’m pretty sure that this is the R quotes linter telling you that you ought be be using double-quote delimiters ("") rather than single-quote delimiters (”)

    The ?Quotes manual page in base R says

    Single and double quotes delimit character constants. They can be
    used interchangeably but double quotes are preferred (and
    character constants are printed using double quotes), so single
    quotes are normally only used to delimit character constants
    containing double quotes.

    (emphasis added).

    You can fix the problem by switching to double-quote delimiters. The other option would be to turn off this linter option. According to @SamR in comments, see here for where your linter definition files might be (~/.lintr is typical) and edit it to include

    linters: linters_with_defaults(quotes_linter = NULL)
    
    Login or Signup to reply.
  2. Like Ben said in his response, this is going to be due to the linter. Now while I don’t know the specific issue, you should be able to check and apply the linters suggestions.

    If this doesn’t work you should be able to disable the linter.

    Acording to the lintr docs you should be able to adjust your .lintr file to set custom rules/exclusions. You can adjust your file to something like this (I would do this as R linting is fairly aggressive)

    linters: linters_with_defaults(
    line_length_linter    = NULL, # note: vscode-R default is 120
    cyclocomp_linter      = NULL, # same as vscode-R
    object_name_linter    = NULL, # same as vscode-R
    object_usage_linter   = NULL, # same as vscode-R
    commented_code_linter = NULL,
    assignment_linter     = NULL,
    seq_linter.           = NULL,
    no_tab_linter.        = NULL,
    semicolon_linter      = NULL,
    single_quotes_linter  = NULL
    )
    

    See this github issue on the vscode-R repository for more information.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search