R 此型号需要软件包,但未安装

R 此型号需要软件包,但未安装,r,R,我正在使用带r的插入符号包的训练功能。 如果我指定了一个尚未安装的包,则方法将显示以下内容 1 package is needed for this model and is not installed. (***). Would you like to try to install it now? 1: yes 2: no 我想回答所有问题1:是的,不必每次都手工输入这个问题,但怎么做呢?这是一个问题 您不应该在安装内部插入符号序列功能之前进行研究 例如,使用: list.of.packag

我正在使用带r的插入符号包的训练功能。 如果我指定了一个尚未安装的包,则方法将显示以下内容

1 package is needed for this model and is not installed. (***). Would you like to try to install it now?
1: yes
2: no
我想回答所有问题1:是的,不必每次都手工输入这个问题,但怎么做呢?

这是一个问题

您不应该在安装内部插入符号序列功能之前进行研究

例如,使用:

list.of.packages <- c("your_package1", "your_package2")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
资料来源: