-
Notifications
You must be signed in to change notification settings - Fork 136
Description
It looks like this is a leftover workaround in tibble from RStudio 1.1:
Line 81 in 490cd37
| # workaround for RStudio v1.1, which relies on the ability to set |
This results in significantly different behavior when running inside vs outside RStudio. Example:
tibble::tibble(x = 1, y = 2) |> unname() |> names()
#> NULL
Sys.unsetenv("RSTUDIO") # Make it look like we're running outside RStudio
tibble::tibble(x = 1, y = 2) |> unname() |> names()
#> [1] NA NA
For me, this caused some pretty unexpected behavior where I was getting different results when a test case was being run via testthat (which will run some tests in an env without RSTUDIO set) vs interactively... took quite a bit of effort to track down.
I'm assuming RStudio v1.1 isn't supported anymore -- is it still necessary in modern RStudio? Would you consider removing the workaround to avoid this brittle behavior? If not, maybe we could add a warning when the workaround is triggered?
Note that also the first case (with the workaround triggered) it creates an unprintable tibble:
tibble::tibble(x = 1, y = 2) |> unname() |> print()
#> Error in names[old] <- names(x)[j[old]] : replacement has length zero
Sys.unsetenv("RSTUDIO") # Make it look like we're running outside RStudio
tibble::tibble(x = 1, y = 2) |> unname() |> print()
#> # A tibble: 1 × 2
#> `` ``
#> <dbl> <dbl>
#> 1 1 2