Lintr integration with RStudio


Is lintr integrated in the current version of RStudio? If not, and if I install & load lintr:


will RStudio pick it up automatically? I’m not bent on using lintr. Any other tool for static analysis of R code is fine, as long as it integrates with RStudio.


Should be. If you run:


Rstudio should open up a “markers” tab.


Thanks @jonathande4. Will test & let you know!


If you install my not-really-realase-ready package adorn you can even assign a hotkey to linting the currently open file in rstudio :slight_smile: devtools::install_bitbucket("s_fleck/adorn")


RStudio comes bundled with a small set of its own static analysis tools, but they are not turned on by default (they currently do not understand, for example, some of the non-standard evaluation performed by the dplyr package, and haven’t yet been tested with the newer tidyeval framework used within the tidyverse). If you’d like to give them a test drive, you can enable additional static analysis checkers here:


@hoelk thanks but I don’t think I can install packages from BitBucket (see my other question). Currently, it’s CRAN or bust for me :slight_smile: I’ll let you know, though


@kevinushey this is very interesting and I didn’t know about that, thanks. Suppose I activate all checks , will they be as comprehensive as lintr? Less? More?


@kevinushey I mean the diagnostics related to R. I’m not planning to use the Other languages diagnostics


It looks to me that lintr is a bit more comprehensive in terms of what kind of analysis it does, although RStudio’s own analysis comes with the bonus that warnings and errors are highlighted directly in the editor, rather than in a markers tab. I haven’t comprehensively compared the two frameworks so I can’t say with certainty, but I think it’s worth trying out both systems.


Good point, getting warnings & errors directly in editor is surely more efficient than having to look at the Markers window. I’ll test both approaches & let you know. Thanks!


@kevinushey @jonathande4 as promised, here is my report after a few days of usage. The RStudio diagnostics in the new RStudio release (btw, dark theme! :+1::night_with_stars:) work fine. The fact they don’t still understand NSE in dplyr can be a bit annoying at times (for example, iris %>% filter(Species == "setosa") raises a no symbol named 'Species' in scope warning), but overall they’re improving my code style, by catching the odd = instead than <- in places, or stuff such as lack of spaces around infix operators, lack of spaces behind commas…I’m usually quite careful about this stuff, but every now and then a slip happens.

I’ve also tried lintr and its integration with RStudio is great, worth more publicity IMO :slight_smile: I like most of its suggestions, not all (as natural, after all there is no arguing about matters of taste).

  • The diagnostics are more immediate and faster (you don’t have to lint(path\to\file) each time you edit your code)
  • lintr is more comprehensive and apparently is not confused by NDE

In the end they complement each other nicely.


Any chance you wanna write this up? I totally agree, and would happily just gif it and take to the tweets, but I feel like the lintr x RStudio integration deserves better…:see_no_evil:


You’re welcome to tweet about it :grin: I’d be happy to write a longer post about it, but currently my only blog outlet is mthe company’s blog, and its target is mainly company customers, rather than R users. I’m planning to put up a personal blog, but it will take some time.


No rush— despite the fact that Yihui has made it as painless as possible, blogging is still surprisingly hard (at least IMHO-- though that’s more the writing than the actual process of assembly)!