R中安装packages 网络超时,下载不完全

问题:安装比较大的R包时,会遇见:网络太慢(只有300秒)导致包没完全下载完,然后报错,如图所示,安装80M的org.Hs.eg.db,网速慢,没下载完就报错:

解决方法:

截图中可以看到,当前下载源为cran.rstudio,网速比较慢

切换到国内源,比如清华源,网速比较快

options("repos") #查看当前下载源
options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor")
options("repos"=c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN"))

切换后,下载成功。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
R语言了解各种R包 This book will guide you from being a user of R packages to being a creator of R packages. In Chapter 1, Introduction, you’ll learn why mastering this skill is so important, and why it’s easier than you think. Next, you’ll learn about the basic structure of a package, and the forms it can take, in Chapter 2, Package Structure. The subsequent chapters go into more detail about each component. They’re roughly organized in order of importance: Chapter 3, R code The most important directory is R/, where your R code lives. A package with just this directory is still a useful package. (And indeed, if you stop reading the book after this chapter, you’ll have still learned some useful new skills.) Chapter 4, Package Metadata The DESCRIPTION lets you describe what your package needs to work. If you’re sharing your package, you’ll also use the DESCRIPTION to describe what it does, who can use it (the license), and who to contact if things go wrong. Chapter 5, Object Documentation If you want other people (including “future you”!) to understand how to use the functions in your package, you’ll need to document them. I’ll show you how to use roxygen2 to document your functions. I recommend roxygen2 because it lets you write code and documentation together while continuing to produce R’s standard documentation format. Chapter 6, Vignettes: Long-Form Documentation Function documentation describes the nitpicky details of every function in your package. Vignettes give the big picture. They’re long-form documents that show how to combine multiple parts of your package to solve real problems. I’ll show you how to use Rmarkdown and knitr to create vignettes with a minimum of fuss. Chapter 7, Testing To ensure your package works as designed (and continues to work as you make changes), it’s essential to write unit tests that define correct behavior, and alert you when functions break. In this chapter, I’ll teach you how to use the testthat package to convert the informal intera
R语言是一种非常流行的统计分析和数据可视化编程语言。为了增强R语言的功能,许多用户开发了各种各样的R包。这些R包包含了特定的功能和算法,并且可以在R环境使用。 要下载R包,首先需要确保已经连接到互联网。然后,可以使用install.packages()函数来下载特定的R包。该函数需要一个字符串参数,其包含要下载的包的名称。例如,要下载包名为“ggplot2”的R包,可以在R控制台输入以下命令: install.packages("ggplot2") 执行此命令后,R会从CRAN(Comprehensive R Archive Network)服务器下载安装ggplot2包。CRAN是一个存储了大量R包的公共数据库。 下载R包可能需要一些时间,具体取决于您的互联网连接速度。下载完成后,可以通过调用library()函数来加载已下载的R包。例如,要加载ggplot2包,可以输入以下命令: library(ggplot2) 加载R包后,您就可以使用其的函数和功能了。 除了从CRAN下载R包,您还可以从其他位置下载自己开发或其他用户开发的R包。为了下载这些包,您需要提供其他下载链接。在使用install.packages()函数时,您可以通过添加参数repos来指定下载链接的地址。例如,要从GitHub下载名为my_package的R包,可以使用以下命令: install.packages("my_package", repos = "https://github.com/username/my_package") 总而言之,通过安装和加载各种R包,您可以扩展R语言的功能,并在统计分析和数据可视化方面进行更多的实践和研究。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值