R 从一个文件夹安装多个软件包
我有一个文件夹,其中包含我在以前的计算机中使用的所有库(>100个压缩二进制文件)。现在我换了一台新电脑。我希望所有这些软件包都安装在新机器的R中。新机器没有直接的internet连接,因为它承载着数据。所以我不能直接安装它们。我也不想手动安装它们。有没有一种方法可以使这个过程自动化,让R读取文件夹,并在该文件夹中安装软件包?先谢谢你 我想像R 从一个文件夹安装多个软件包,r,install.packages,R,Install.packages,我有一个文件夹,其中包含我在以前的计算机中使用的所有库(>100个压缩二进制文件)。现在我换了一台新电脑。我希望所有这些软件包都安装在新机器的R中。新机器没有直接的internet连接,因为它承载着数据。所以我不能直接安装它们。我也不想手动安装它们。有没有一种方法可以使这个过程自动化,让R读取文件夹,并在该文件夹中安装软件包?先谢谢你 我想像list.files和grep这样的函数在这里会有帮助吗 我使用Windows7和R3.1.0。试试这个 setwd("path/packages/") #
list.files
和grep
这样的函数在这里会有帮助吗
我使用Windows7和R3.1.0。试试这个
setwd("path/packages/") #set the working directory to the path of the packages
pkgs <- list.files()
install.packages(c(print(as.character(pkgs), collapse="\",\"")), repos = NULL)
setwd(“path/packages/”)#将工作目录设置为包的路径
pkgs试试这个
setwd("path/packages/") #set the working directory to the path of the packages
pkgs <- list.files()
install.packages(c(print(as.character(pkgs), collapse="\",\"")), repos = NULL)
setwd(“path/packages/”)#将工作目录设置为包的路径
pkgs我们在非internet服务器上有300多个包。因此,我们将所有包复制到指定目录
setwd("location/to/a/specified/directory") #set the working directory to the path of the packages
pkgs1 <- list.files()
install.packages(pkgs1 , repos = NULL, type = source )
setwd(“location/to/a/specified/directory”)#将工作目录设置为包的路径
pkgs1我们在非internet服务器上有300多个包。因此,我们将所有包复制到指定目录
setwd("location/to/a/specified/directory") #set the working directory to the path of the packages
pkgs1 <- list.files()
install.packages(pkgs1 , repos = NULL, type = source )
setwd(“location/to/a/specified/directory”)#将工作目录设置为包的路径
pkgs1我必须添加type=“binary”使其适合我
setwd("path/packages/") #set the working directory to the path of the packages
pkgs <- list.files()
install.packages(c(print(as.character(pkgs), collapse="\",\"")), repos = NULL, type= "binary")
setwd(“path/packages/”)#将工作目录设置为包的路径
pkgs我必须添加type=“binary”使其适合我
setwd("path/packages/") #set the working directory to the path of the packages
pkgs <- list.files()
install.packages(c(print(as.character(pkgs), collapse="\",\"")), repos = NULL, type= "binary")
setwd(“path/packages/”)#将工作目录设置为包的路径
pkgs如果您在ubuntu或任何其他linux发行版上。确定存储下载包的tmp文件夹。通常是“/tmp/Rtmp”文件夹。您需要将工作目录设置为此文件夹
setwd("location of the directory")
pkg <- list.files()
install.packages(pkg, repos = NULL, type = "source")
setwd(“目录的位置”)
pkg如果您使用的是ubuntu或任何其他linux发行版。确定存储下载包的tmp文件夹。通常是“/tmp/Rtmp”文件夹。您需要将工作目录设置为此文件夹
setwd("location of the directory")
pkg <- list.files()
install.packages(pkg, repos = NULL, type = "source")
setwd(“目录的位置”)
pkg但是如何对依赖项进行排序?如果所需的依赖项在文件列表中的位置较低,则安装将失败。需要回答中建议的type=“binary”
,但如何对依赖项进行排序?如果所需的依赖项在文件列表中的位置较低,则安装将失败。。它需要回答中建议的type=“binary”