在不安装包的情况下列出 R 包依赖项 [英] Listing R Package Dependencies Without Installing Packages

查看:30
本文介绍了在不安装包的情况下列出 R 包依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以获取给定包的 R 包依赖项(所有递归依赖项)列表,而无需安装该包及其依赖项?类似于 portupgrade 或 apt 中的虚假安装.

Is there a simple way to get a list of R package dependencies (all recursive dependencies) for a given package, without installing the package and it's dependencies? Something similar to a fake install in portupgrade or apt.

推荐答案

您可以使用 available.packages 函数的结果.例如,要查看 ggplot2 依赖什么:

You can use the result of the available.packages function. For example, to see what ggplot2 depends on :

pack <- available.packages()
pack["ggplot2","Depends"]

给出:

[1] "R (>= 2.14), stats, methods"

请注意,根据您想要实现的目标,您可能还需要检查 Imports 字段.

Note that depending on what you want to achieve, you may need to check the Imports field, too.

这篇关于在不安装包的情况下列出 R 包依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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