1 R language
This part includes basic & adavanced, elegant & crazy, and three reason I like R best: - convenient to share code by R package - automatically report with R markdown - wonderful packages for data manipulation and visualization
1.1 when I use
- function definition
- initialize varible, especially when definition is far from first usage (initialize means you create the varible only once)
foobar(...) <- value, though it’s okay to use
=, but modifing arguments using function is rare in R, so use
<-can help you remind what you are doing and be consistency with how the function is defined
remotes::package_deps(.packages(T)) %>% tibble::as_tibble()
1.3 install packages
remotes::install_bioc('3.7/ggtree')looks good, however, this only works package-wise, i,e, dependency packages still use the default Bioconductor version 1.
/usr/lib/R/libraryshould keep clean, which makes it very convenient to update or reinstall R.
/usr/lib/R/site-libraryis useful when there are many users, and they all need many common packages. 2
/usr/local/lib/R/site-libraryshould be removed 3.
- user library, I prefer to use
~/.local/lib/R4, although RStudio’s default is
At the time of this writing,
remotes::install_bioc('clusterProfiler')would use Bioconductor 3.8↩︎
Another example is a server with Shiny Server installed. There
rootmay need some packages for Shiny apps hosted. And the normal user can also use these packages, although he may not need.↩︎
I get duplicated packages when I use