2

Here is a example situation: I have a tidyr v0.8.0 already installed, but let's say I want to tinker with a tidyr v0.8.2 without affecting my current system. How do you do this?

In python, I can make a virtual environment or conda environment and install the dependencies, but I am not sure what's the similar approach in R. I know packrat exists for dependency management, but the individual package such astidyr doesn't come with packrat directory.

Anyway, currently, if I use the following commands, I get an error

git clone https://github.com/tidyverse/tidyr.git
cd tidyr && git checkout v0.8.2
open tidyr.Rproj # open Rstudio project

# in Rstudio
> devtools::test()

like this

Loading tidyr
Loading required package: testthat
Testing tidyr
test-append.R: ..........
complete: .........
drop_na: ..........
expand: .....1.................
Extract: ..........
fill: .................
full_seq: .....
Gather: 23456789abcdefFFFFEEEEEEE
id: ...
nest: EEEEEEE
replace_na: .......
test-separate-rows.R: ..............
Separate: .....................................
Spread: W....................................................
test-uncount.R: ......
Deprecated SE variants: E....EE..EEEE......EE.
unite: EEEEE
unnest: ...............................

I think this is happening because it's using system's tidyr rather than developmental version

> packageVersion("tidyr")
[1] ‘0.8.0’

So going back to my original question,

how do you do the isolated package development in R?

Alby
  • 5,522
  • 7
  • 41
  • 51

0 Answers0