1.安裝R包
鏡像設(shè)置
options()$repos
查看所用鏡像
1)用Rstudio代碼設(shè)置鏡像
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")) #對應(yīng)清華源
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/") #對應(yīng)中科大源
2)R的配置文件(一勞永逸法)
file.edit('~/.Rprofile')
在打開的.Rprofile中寫入代碼
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")) #對應(yīng)清華源
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/") #對應(yīng)中科大源
保存并重啟Rstudio
安裝
#安裝:
install.packages(“包”)
BiocManager::install(“包”)
#加載:
library(包)
require(包)
R的幾種利器包(package)桐臊,如dplyr(數(shù)據(jù)處理神包)帕涌、ggplot2(畫圖神器)、shiny(網(wǎng)頁開發(fā)神包)、rvest(網(wǎng)絡(luò)數(shù)據(jù)爬炔芭妗)、sp(地理數(shù)據(jù)分析包)等浸策。
2. dplyr包
5個基本函數(shù)
mutate()
select()1
select()2
filter()
arrange()
summarise()
2個實(shí)用技能
1)管道操作%>% (windows快捷鍵ctrl+shift+M)
參考文章:R語言中的管道%>%
管道%>%
2)count
count()
處理關(guān)系數(shù)據(jù)
1)各種join
連接
2)兩個bind
合并
思維導(dǎo)圖
dplyr包