The tidyverse style guide inconsistent with RStudio style diagnostics

It seems that the 'Tidyverse Style Diagnostic' written by Hadley Wickham is inconsistent with the 'R Style Diagnostics' in RStudio.

R Studio flags white spaces in {{ x }} as unnecessary whitespaces:

enter image description here

while the style guide explicitly suggests to use whitespaces when embracing with {{:

enter image description here

Since Wickham is Chief Scientist at RStudio I would think he would want the two to be consistent. Is there any good place to point this out to the folks at RStudio?

I'm on RStudio, Version 1.4.1512, and am struggling to replicate this.

This may be an edge case, could you give a minimal reprex?

This is definitely a strange edge case I presume. I'm looking at this code piece:

# good and bad

ggplot(data) + 
     
	scale_fill_viridis_c(begin = 0,
     				 alpha = 0.5,
     				 direction = -1,
     				 na.value = "gray",
     				 trans = "log",
                          breaks = {{ legend_breaks }},
                          labels = {{ legend_labels }} ) 

In my original script (Rmd) it gets flagged as unnecessary whitespace so I copied this part to a new script and it didn't get flagged. However, once I saved the file and when back to the source window it was flagged:

I'm running RStudio 1.4.1103, but when checking for updates it tells me I have the latest version.

Thanks for the report -- I've filed this issue here. https://github.com/rstudio/rstudio/issues/8822

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.