在运行install.packages()之前检查安装的软件包. [英] Check for installed packages before running install.packages()

查看:80
本文介绍了在运行install.packages()之前检查安装的软件包.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个R脚本,可以与不同计算机上的多个用户共享.其中一行包含install.packages("xtable")命令.

I have an R script that is shared with several users on different computers. One of its lines contains the install.packages("xtable") command.

问题在于,每次有人运行脚本时,R都会花费大量时间来重新安装该软件包(实际上确实要花一些时间,因为实际情况中包含多个软件包的向量).

The problem is that every time someone runs the script, R spends a great deal of time apparently reinstalling the package (it actually does take some time, since the real case has vector of several packages).

如何首先检查软件包是否已安装,然后仅对未安装的软件包运行install.packages()?

How can I make first check if the packages are installed and then only run install.packages() for the ones that are not?

推荐答案

尝试:require("xtable")"xtable" %in% rownames(installed.packages())

这篇关于在运行install.packages()之前检查安装的软件包.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆