Display leading/trailing whitespaces in RStudio data viewer?

rstudio

#1

One feature that I love about the tibble package is that "hidden" white spaces are made obvious with quotations.

aa <- tibble::tibble(abc= c("one", "two ", " three"))
aa
#> # A tibble: 3 x 1
#>   abc
#>   <chr>   
#> 1 one     
#> 2 "two "  
#> 3 " three"

For larger datasets, however, I like to use the RStudio data viewer (View(aa)) to take a quick look at the data for problems. However, leading and trailing whitespaces disappear, making it difficult to diagnose the problem. Is there a way to somehow "un-hide" the white spaces in View? (at the very least, for leading white spaces)

image


#2

Hey Irene,

This might make for a good feature request over in the IDE repo, if there isn't one already!

Mara


#3

We fixed the leading space issue in RStudio 1.2. You can try a preview build if you'd like:

https://www.rstudio.com/products/rstudio/download/preview/

image


#4

Neat! That's great to know.

@jonathan are there already plans for dealing with trailing spaces? I'm imagining something to show/hide formatting marks like in MS Word...

image


#5

No, that isn't currently on the radar (but feel free to file a feature request!)


#6

Feature request submitted: https://github.com/rstudio/rstudio/issues/3428 :partying_face: