Cleaning up my R packages and config files

Today was an unusual day at work given the US Elections. This meant that I had fewer meetings than what I’ve had lately. Earlier in the day I noticed an email announcing that the Bioconductor 3.13 docker image had been released for the next 6 month development cycle, which was a reminder of the recent Bioconductor 3.12 release. This prompted me to start updating my R packages.

In the past, I’ve updated all my currently installed R packages using the framework I described in a 2017 blog post. I remember seeing a tweet by Hadley Wickham not so long ago 1 that for him, a new R version was an opportunity to start with a clean slate. I like having everything I need ready to use, but well, my list of installed R packages was getting pretty long. Given that 4 year windows of time are in our minds, it felt like a good opportunity to clean my house. Or well, my R packages.

Thus, I started writing down which are the packages I want to have installed. At this point for me, that includes several R/Bioconductor packages I’ve made and their dependencies in case I need to work on them to resolve bugs or add new features. My R packages already use many of my favorite R packages, so I took advantage of this in order to avoid having to list every single R package I like using. In order to achieve this, I used the dependencies = TRUE argument that you can use with remotes and BiocManager.

## Install from scratch
if (!requireNamespace("remotes", quietly = TRUE))
    install.packages("remotes")
remotes::install_cran("BiocManager")
BiocManager::version()

## Rprofile packages
remotes::install_github(c(
    "jalvesaq/colorout"
))
remotes::install_cran(c(
    "devtools",
    "usethis"
))

## Main packages
BiocManager::install(c(
    "biocthis",
    "brainflowprobes",
    "derfinder",
    "derfinderPlot",
    "GenomicState",
    "megadepth",
    "recount",
    "recountWorkflow",
    "recount3",
    "regutools",
    "regionReport",
    "spatialLIBD"
), dependencies = TRUE, update = FALSE)

Once I had my main packages, I started adding some from LIBD, some from CRAN, and other ones from Bioconductor. You can see the full list at my team’s website under Config files: R setup; R packages.

I was curious about how these changes affected my list of installed R packages and used my older 2017 blog post code to check this. That resulted in this list which shows 423 installed R packages and 589 that I used to have installed. I suspect that several of them will come back. For example, I needed to install blogdown to work on this blog post. Some of the 423 packages are new, like rsthemes which we recently learned about at the LIBD rstats club.

Config files

Since I was doing all this work on both my macOS and Windows laptops for my R setup, I also went ahead and cleaned up a bit my configuration files. I have several of them with settings that I recommend others to use. That’s why I wrote a little “chapter” about them on my team’s website. The list includes:

  • Software I use (including R and RStudio)
  • R packages
  • R configuration files such as ~/.Rprofile and ~/.Renviron
  • Git configuration files ~/.gitconfig and ~/.gitignore_global
  • JHPCE (linux) configuration files such as ~/.bashrc, ~/.inputrc, ~/.bash_profile and ~/.sge_request

Wrapping up

I’m hoping that all this information will be useful to both current and new team members, but it could be useful also to you. Though you might need to adapt some things. Earlier on in my career I learned from how others use configuration files to speed up their work or make their work experience more enjoyable. I’m still learning, but now I have a decent bag of tricks to share too.

Have fun!

Image source

References

[1] C. Boettiger. knitcitations: Citations for ‘Knitr’ Markdown Files. R package version 1.0.10. 2020. URL: https://github.com/cboettig/knitcitations.

[2] G. Csárdi, R. core, H. Wickham, W. Chang, et al. sessioninfo: R Session Information. R package version 1.1.1. 2018. URL: https://CRAN.R-project.org/package=sessioninfo.

[3] A. Oles, M. Morgan, and W. Huber. BiocStyle: Standard styles for vignettes and other Bioconductor documents. R package version 2.18.0. 2020. URL: https://github.com/Bioconductor/BiocStyle.

[4] Y. Xie, A. P. Hill, and A. Thomas. blogdown: Creating Websites with R Markdown. ISBN 978-0815363729. Boca Raton, Florida: Chapman and Hall/CRC, 2017. URL: https://github.com/rstudio/blogdown.

Reproducibility

## - Session info -------------------------------------------------------------------------------------------------------
##  setting  value                       
##  version  R version 4.0.3 (2020-10-10)
##  os       Windows 10 x64              
##  system   x86_64, mingw32             
##  ui       RTerm                       
##  language (EN)                        
##  collate  English_United States.1252  
##  ctype    English_United States.1252  
##  tz       America/New_York            
##  date     2020-11-03                  
## 
## - Packages -----------------------------------------------------------------------------------------------------------
##  package       * version date       lib source                                 
##  assertthat      0.2.1   2019-03-21 [1] CRAN (R 4.0.3)                         
##  BiocManager     1.30.10 2019-11-16 [1] CRAN (R 4.0.3)                         
##  BiocStyle     * 2.18.0  2020-10-27 [1] Bioconductor                           
##  blogdown        0.21    2020-10-11 [1] CRAN (R 4.0.3)                         
##  bookdown        0.21    2020-10-13 [1] CRAN (R 4.0.3)                         
##  cli             2.1.0   2020-10-12 [1] CRAN (R 4.0.3)                         
##  crayon          1.3.4   2017-09-16 [1] CRAN (R 4.0.3)                         
##  digest          0.6.27  2020-10-24 [1] CRAN (R 4.0.3)                         
##  evaluate        0.14    2019-05-28 [1] CRAN (R 4.0.3)                         
##  fansi           0.4.1   2020-01-08 [1] CRAN (R 4.0.3)                         
##  generics        0.1.0   2020-10-31 [1] CRAN (R 4.0.3)                         
##  glue            1.4.2   2020-08-27 [1] CRAN (R 4.0.3)                         
##  htmltools       0.5.0   2020-06-16 [1] CRAN (R 4.0.3)                         
##  httr            1.4.2   2020-07-20 [1] CRAN (R 4.0.3)                         
##  jsonlite        1.7.1   2020-09-07 [1] CRAN (R 4.0.3)                         
##  knitcitations * 1.0.10  2020-11-03 [1] Github (cboettig/knitcitations@ea5d202)
##  knitr           1.30    2020-09-22 [1] CRAN (R 4.0.3)                         
##  lubridate       1.7.9   2020-06-08 [1] CRAN (R 4.0.3)                         
##  magrittr        1.5     2014-11-22 [1] CRAN (R 4.0.3)                         
##  plyr            1.8.6   2020-03-03 [1] CRAN (R 4.0.3)                         
##  R6              2.5.0   2020-10-28 [1] CRAN (R 4.0.3)                         
##  Rcpp            1.0.5   2020-07-06 [1] CRAN (R 4.0.3)                         
##  RefManageR      1.3.0   2020-11-03 [1] Github (ropensci/RefManageR@ab8fe60)   
##  rlang           0.4.8   2020-10-08 [1] CRAN (R 4.0.3)                         
##  rmarkdown       2.5     2020-10-21 [1] CRAN (R 4.0.3)                         
##  sessioninfo   * 1.1.1   2018-11-05 [1] CRAN (R 4.0.3)                         
##  stringi         1.5.3   2020-09-09 [1] CRAN (R 4.0.3)                         
##  stringr         1.4.0   2019-02-10 [1] CRAN (R 4.0.3)                         
##  withr           2.3.0   2020-09-22 [1] CRAN (R 4.0.3)                         
##  xfun            0.19    2020-10-30 [1] CRAN (R 4.0.3)                         
##  xml2            1.3.2   2020-04-23 [1] CRAN (R 4.0.3)                         
##  yaml            2.2.1   2020-02-01 [1] CRAN (R 4.0.3)                         
## 
## [1] D:/R/R-4.0.3/library

  1. I couldn’t find the tweet right now.↩︎

comments powered by Disqus

Related