一次加载多个软件包 [英] Load multiple packages at once

查看:76
本文介绍了一次加载多个软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何一次加载一堆软件包而又不必一遍又一遍地重新键入require命令?我已经尝试了三种方法,所有方法都会崩溃和燃烧.

How can I load a bunch of packages at once with out retyping the require command over and over? I've tried three approaches all of which crash and burn.

基本上,我想向要加载它们的函数提供程序包名称的向量.

Basically, I want to supply a vector of package names to a function that will load them.

x<-c("plyr", "psych", "tm")

require(x)
lapply(x, require)
do.call("require", x)

推荐答案

建议的函数的多个排列确实可以工作-但前提是您将character.only参数指定为TRUE.快速示例:

Several permutations of your proposed functions do work -- but only if you specify the character.only argument to be TRUE. Quick example:

lapply(x, require, character.only = TRUE)

这篇关于一次加载多个软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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