R语言笔记Day1(三 函数与R包)

2020-01-12  本文已影响0人  养猪场小老板

1. 函数

嵌套函数

> g <- function(x,y=0.5){
+ seq(x,3*x,0.5)
+ }
> g(3)
 [1] 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0

2. R包

2.1 R包来源

(1)CRAN网站:https://cran.r-project.org/web/views/
安装:install.packages()
(2)Bioconductor网站:https://bioconductor.org/
安装:BiocManager::install()
(3)github网站:https://github.com/
安装:devools::install_github()

2.2 每次安装完之后需要加载library()

library()是检查是否安装成功的标准

2.3 R包安装需要设置镜像

有两种方法:手动设置和代码设置
a.
tools--global option-packages-CRAN mirror
b.清华的镜像
options("repos"=c(CRAN="https://mir
rors.tuna.tsinghua.edu.cn/CRAN/"))
options(BioC_mirror="https://mirrors.
ustc.edu.cn/bioc/")

2.4 常见问题

安装错误.png 安装G0db.png
上一篇 下一篇

猜你喜欢

热点阅读