R language is a mathematical programming language designed for mathematical researchers. It is mainly used for statistical analysis, drawing and data mining. R language is a language for interpretation and operation (different from the compilation and operation of C language). Its execution speed is much slower than C language, which is not conducive to optimization. However, it provides richer data structure operations at the grammatical level, and can easily output text and graphic information, so it is widely used in mathematics, especially in the field of statistics. This is also the reason why most students choose R language.
1. Learning resources
-
Recommended books: R language practice, R data science, etc;
The two books have pdf version in the official account, and they can be concerned about the official account of the public. If you want to reply to the R language, you can get free electronic books.
-
What if you encounter a bug
-
Necessary for beginners of R language - cheatsheet: https://www.rstudio.com/resources/cheatsheets/
-
R language rookie tutorial: https://www.runoob.com/r/r-tutorial.html
-
Jianshu, Zhihu and other major platforms will provide many common tutorials of student information analysis. We must make good use of these resources;
-
What to do if you report an error: Du Niang comes to help; Must learn Baidu! Must learn Baidu! Must learn Baidu!
-
2. Understand and install R, Rstudio and R package
-
Download Software in R language: https://cran.r-project.org/bin
-
Download the Rstudio R editor: https://www.rstudio.com/products/rstudio/download/
Basic R language tutorial of essential skills of Shengxin - R package installation
-
Install some necessary packages:
-
What is an R package: a package is a collection of R functions, instance data, and precompiled code, including R programs, annotation documents, instances, and test data;
-
Install package install packages(" xxxxxx ")
Packages commonly used in bioinformatics can be installed using the BiocManager::install("xxxx") function
-
Load package library (xxxxx)
-
View the package's help document help("xxxxx") or? xxxxx
-
#Some R packages necessary for bioinformatics analysis can be run directly by copying the following code; rm(list = ls()) #Set mirroring: options()$repos options()$BioC_mirror #options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/") options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/") options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")) options()$repos options()$BioC_mirror #Method 1: options()$repos install.packages('WGCNA') install.packages(c("FactoMineR", "factoextra")) install.packages(c("ggplot2", "pheatmap","ggpubr")) library("FactoMineR") library("factoextra") #Method 2: if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("KEGG.db",ask = F,update = F) BiocManager::install(c("GSEABase","GSVA","clusterProfiler" ),ask = F,update = F) BiocManager::install(c("GEOquery","limma","impute" ),ask = F,update = F) BiocManager::install(c("org.Hs.eg.db","hgu133plus2.db" ),ask = F,update = F) #Method 3: install from github #All R packages are submitted and uploaded to CRAN, such as Github, and need to be installed through certain channels #R install devtools package install.packages("devtools") library(devtools) #Install R package on github (need to climb over the wall or change hosts) devtools::install_github('lchiffon/REmap') #The former is the user name of github, and the latter is the package name #Test - load R package; library(REmap) library(GSEABase) library(GSVA) library(clusterProfiler) library(ggplot2) library(ggpubr) library(hgu133plus2.db) library(limma) library(org.Hs.eg.db) library(pheatmap)
-
Get current working interval getwd()
-
Change working interval setwd ("XXXXXX")
-
Clear current object rm(xx)
Basic course of R language - R package loading