R - vanhoan310/tips GitHub Wiki

TUTORIAL

If a package can not be installed, using conda install r-package

  1. Tutorial https://docs.google.com/document/d/1vT4QiUeSAXc2YEU3LOCWgaZvYvUY6Dod3qrCvaUeepg/edit
  2. Specific to SC3, SingleCellExperiment object https://docs.google.com/document/d/1_x12Gta9WsGMA3DUATxG6DypdwuwSNZDK2vr8P3PWrM/edit
  3. Plots https://cedricscherer.netlify.app/2019/08/05/a-ggplot2-tutorial-for-beautiful-plotting-in-r/
  4. R for data science: https://r4ds.had.co.nz/transform.html
  5. Data transformation: https://www.guru99.com/r-dplyr-tutorial.html

TIPS

  1. 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 rstudio install.packages("png", "/home/user/anaconda3/lib/R/library")

  2. Factor https://stackoverflow.com/questions/4329635/levels-in-r-dataframe

  3. Tutorial http://www.kateto.net/wp-content/uploads/2016/01/NetSciX_2016_Workshop.pdf

  4. Fix R no connection http://tinyheero.github.io/2016/11/12/bioconductor-conda.html

  5. Install Seurat with fake hdf5r https://github.com/UCSF-TI/fake-hdf5r

  6. Fix igraph install https://github.com/igraph/rigraph/issues/274

  7. 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

  8. 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

  9. HDF5 https://pachterlab.github.io/kallisto/local_build.html install.packages('hdf5r', configure.args = '--with-hdf5=/home/vanhoan310/bin/h5cc')

  10. Seurat libpath export LD_LIBRARY_PATH=/home/vanhoan310/lib:$LD_LIBRARY_PATH

  11. Install gsl

  1. 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
  2. Copy file /home/vanhoan310/gls/gsl-config to /usr/bin/gsl-config
  3. Run command CFLAGS="-I/home/vanhoan310/gsl/include" LDFLAGS="-L/home/vanhoan310/gsl/lib -lgsl -lgslcblas" R
  4. install.packages("gsl")
  1. 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"

  1. Paths and permission https://stackoverflow.com/questions/41839214/installation-path-not-writable-r-unable-to-update-packages

  2. 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

  1. 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

  2. Use R script from Rstudio: /opt/R/3.6.3/lib64/R/bin/Rscript

  3. GIthub exceed request (need to setup a GITHUB PAT): https://www.youtube.com/watch?v=c14aqVC-Szo&ab_channel=TheCoatlessProfessor

  4. GIT PAT github_pat(1) Sys.getenv("GITHUB_PAT") Sys.unsetenv("GITHUB_PAT") Sys.getenv("GITHUB_PAT")

  5. Install R 4.1 https://docs.google.com/document/d/1IqKr9nepRELPE0SQKRZV-tGAhQ2AC1Mk1bwtYvEj6a8/edit?usp=sharing

  6. Install package using conda: conda install conda-forge::r-rgdal