R函数集锦持续更新中

数据类型函数

c()、matrix()、array()、data.frame()、factor()、list()

R包安装、加载、清除

install.packages("")、BiocManager::install("")、devtools::install_github('')
library(WGCNA):用包前先加载包
(.packages()),detach("package:WGCNA"):查看加载进的包,没有参数、清除加载包
install.packages("mvtnorm", repos = "http://R-Forge.R-project.org")

R自带函数

as.Date()
cbind():合并column
file.exists(x):x变量的存的路径是否存在,返回TRUE or FALSE
file.path(x, y):返回组合路径
head():
is.na()
list.files(path = ".", pattern = NULL, recursive = FALSE):列举出pattern模式的文件名字,
merge(x,y,by=""):根据inner join合并数据
na.omit()
nchar(x)、length(x):返回位置上字符串长度[nums]、返回多少个字符串[num]
rbind():合并行
sample()
str(x):返回对象x的信息,非常好用
sub()、gsub():sub(pattern, replacement, x, ignore.case = FALSE)返回替换后字符
subset():subset(df,col1 >5 |col2=="i",select=c("col1","col2"))
substring(text, first, last):截取字符串,first,last可是vector
sort(x,decreasing=F):升序排序
Sys.Date()
tail()
order(): 返回排序的索引,可以给多个参数
plot():画图及参数设置等

  • pdf()
    png()
    jpeg()
    bmp()
    tiff()
    xfig()
  • par()、mfrow()
  • colors()、rainbow()
  • title()
  • abline()
  • legend()
  • text()
  • layout()

R包内的函数

stringr::str_split(string, pattern, simplify = FALSE)


你可能感兴趣的:(R函数集锦持续更新中)