2017-02-15 109 views
-1

我正在使用DeployR for Microsoft R Server 2016,8.0.5 for Windows。DeployR:如何安装R包

我想与Excel文件安装包XLConnect工作:

> install.packages("XLConnect") 
package 'XLConnect' successfully unpacked and MD5 sums checked 

The downloaded binary packages are in 
C:\Windows\Temp\RtmpYnppvI\downloaded_packages 

> library("XLConnect") 
Console Error there is no package called 'XLConnect' 
API Error there is no package called 'XLConnect' 

出了什么问题?谢谢。

+0

'library(XLConnect)',另请参阅[readxl](https://cran.r-project.org/web/packages/readxl/index.html)包。 –

回答

0

如果我们与deployR工作,有一个名为deployrUtils包,它已经拥有了deployrPackage函数加载和安装包(如果不存在)

library(deployrUtils) 
deployrPackage("XLConnect") 

下面是deployrPackage

的代码片段关于 deployrUtils的不同功能
deployrPackage <- function(pkgs, lib, repos = getOption("repos"), ...) { 
    # 
    # this function checks to see if the declared pkgs are installed. If not, 
    # pkgs are installed. In all cases the packages are loaded 
    # 
    if (!suppressWarnings(require(pkgs, character.only = TRUE))) { 
    install.packages(pkgs, lib, repos = repos, ...) 
    if(!suppressWarnings(require(pkgs, character.only = TRUE))) { 
     stop("Package not found") 
    } 
    } 

    suppressWarnings(require(pkgs, character.only = TRUE)) 
} 

更多信息,可以发现here

+0

谢谢,我明白了,但我现在认为,即使使用'deployrPackage(“XLConnect”)'得到相同的消息,所以我尝试加载的任何包都不起作用,不幸的是。 – Anette

+0

@Anette请检查您的配置。它应该基于指南工作,我也使用deployR – akrun

+0

是的,当然。那么我是全新的deployR。我没有管理员权限,所以我想这个问题是因为这个原因? – Anette