R - vanhoan310/tips GitHub Wiki
TUTORIAL
If a package can not be installed, using conda install r-package
- Tutorial https://docs.google.com/document/d/1vT4QiUeSAXc2YEU3LOCWgaZvYvUY6Dod3qrCvaUeepg/edit
- Specific to SC3, SingleCellExperiment object https://docs.google.com/document/d/1_x12Gta9WsGMA3DUATxG6DypdwuwSNZDK2vr8P3PWrM/edit
- Plots https://cedricscherer.netlify.app/2019/08/05/a-ggplot2-tutorial-for-beautiful-plotting-in-r/
- R for data science: https://r4ds.had.co.nz/transform.html
- Data transformation: https://www.guru99.com/r-dplyr-tutorial.html
TIPS
-
Install conda https://stackoverflow.com/questions/38534383/how-to-set-up-conda-installed-r-for-use-with-rstudio http://tinyheero.github.io/2016/11/12/bioconductor-conda.html
conda install -c r rstudioinstall.packages("png", "/home/user/anaconda3/lib/R/library") -
Factor
https://stackoverflow.com/questions/4329635/levels-in-r-dataframe -
Tutorial http://www.kateto.net/wp-content/uploads/2016/01/NetSciX_2016_Workshop.pdf
-
Fix R no connection http://tinyheero.github.io/2016/11/12/bioconductor-conda.html
-
Install Seurat with fake hdf5r https://github.com/UCSF-TI/fake-hdf5r
-
Fix igraph install https://github.com/igraph/rigraph/issues/274
-
Set paths (temporary) .libPaths("/usr/local/include") .libPaths(c( .libPaths(),"/home/vanhoan310/miniconda3/lib/R/library")) https://stackoverflow.com/questions/15170399/change-r-default-library-path-using-libpaths-in-rprofile-site-fails-to-work
-
Parallel 2 foreach https://stackoverflow.com/questions/31357439/parallel-foreach-with-two-arguments https://stackoverflow.com/questions/15170399/change-r-default-library-path-using-libpaths-in-rprofile-site-fails-to-work
-
HDF5 https://pachterlab.github.io/kallisto/local_build.html install.packages('hdf5r', configure.args = '--with-hdf5=/home/vanhoan310/bin/h5cc')
-
Seurat libpath export LD_LIBRARY_PATH=/home/vanhoan310/lib:$LD_LIBRARY_PATH
-
Install gsl
- Install gsl 2.2 from source: https://coral.ise.lehigh.edu/jild13/2016/07/11/hello/ to /home/vanhoan310/gls http://www.linuxfromscratch.org/blfs/view/svn/general/gsl.html
- Copy file /home/vanhoan310/gls/gsl-config to /usr/bin/gsl-config
- Run command CFLAGS="-I/home/vanhoan310/gsl/include" LDFLAGS="-L/home/vanhoan310/gsl/lib -lgsl -lgslcblas" R
- install.packages("gsl")
- My libpath
.libPaths() [1] "/home/vanhoan310/R/x86_64-redhat-linux-gnu-library/3.5" [2] "/usr/lib64/R/library"
[3] "/usr/share/R/library"
-
Paths and permission https://stackoverflow.com/questions/41839214/installation-path-not-writable-r-unable-to-update-packages
-
Install Monocle 3: a. https://github.com/r-spatial/sf b. https://github.com/cole-trapnell-lab/monocle3/issues/234 https://community.rstudio.com/t/installing-gdal-2-0-on-redhat/24793/3 https://github.com/cole-trapnell-lab/monocle3/issues/234 Here: https://github.com/cole-trapnell-lab/monocle3/tree/0.1.3 Fedora pacakges: https://stackoverflow.com/questions/53389181/installing-the-r-package-rgeos-on-linux-geos-config-not-found-or-not-executab
https://gis.stackexchange.com/questions/120101/building-gdal-with-libkml-support/120103#120103
-
Install R 4.0 https://cran.r-project.org/bin/windows/base/rpatched.html Install Rtool and R-testing https://cran.r-project.org/bin/windows/testing/rtools40.html https://cran.r-project.org/bin/windows/Rtools/ install_github("kthohr/BMR", INSTALL_opts="--no-multiarch") https://github.com/kthohr/BMR/issues/34
-
Use R script from Rstudio: /opt/R/3.6.3/lib64/R/bin/Rscript
-
GIthub exceed request (need to setup a GITHUB PAT): https://www.youtube.com/watch?v=c14aqVC-Szo&ab_channel=TheCoatlessProfessor
-
GIT PAT
github_pat(1)Sys.getenv("GITHUB_PAT")Sys.unsetenv("GITHUB_PAT")Sys.getenv("GITHUB_PAT") -
Install R 4.1 https://docs.google.com/document/d/1IqKr9nepRELPE0SQKRZV-tGAhQ2AC1Mk1bwtYvEj6a8/edit?usp=sharing
-
Install package using conda: conda install conda-forge::r-rgdal