A way to quickly test a code snippet on an earlier version of a tidyverse package?

Is there a way I can check what the following code does in a previous version of dplyr?

tibble(a = c(1,1,2,3)) %>% count(a) %>% add_count(a)

I'm running version 0.8.3 in R 3.6.1, this is the result:

# A tibble: 3 x 2
      a     n
  <dbl> <int>
1     1     1
2     2     1
3     3     1

And I'm pretty sure that in a previous version the result would have been an added column nn, like:

# A tibble: 3 x 3
      a     n    nn
  <dbl> <int> <int>
1     1     2     1
2     2     1     1
3     3     1     1

But I need to be sure and prefer without re-installing dplyr in a previous version, then re-installing the latest etc.

Thanks.

One option is to have multiple libraries:

Personally, I'll keep an rstudio cloud project with older versions. For example, here's the output from dplyr 0.7.6

library(dplyr)

tibble(a = c(1,1,2,3)) %>% count(a) %>% add_count(a)
#> # A tibble: 3 x 3
#>       a     n    nn
#>   <dbl> <int> <int>
#> 1     1     2     1
#> 2     2     1     1
#> 3     3     1     1

Also linking to the issue you filed, so the thread and issue can stay together

1 Like

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