简体   繁体   English

在构建和安装创建的R软件包时出现问题

[英]Issues building and installing a created R package

I have created an R package (not yet on CRAN) and sent it to a colleague (as a .zip file). 我创建了一个R包(尚未在CRAN上)并将其发送给同事(作为.zip文件)。

Unfortunately, they were unable to properly build/install it without R throwing an error. 不幸的是,如果没有R抛出错误,他们将无法正确构建/安装它。

The error received was: 收到的错误是:

Error: Command failed (1)
In addition: Warning message:
The following packages are referenced using Rcpp::depends attributes however    are not listed in the Depends, Imports or LinkingTo fields of the package     DESCRIPTION file: RcppProgress 

To create the package, I used the RcppArmadillo.package.skeleton() function in R v. 3.4.3. 为了创建包,我在R v.3.4.3中使用了RcppArmadillo.package.skeleton()函数。

I works for me, but not for my colleague. 我为我工作,但不为我的同事工作。

My method in building/installing is: 我的构建/安装方法是:

build("package name") # creates a .tar.gz file
install("package name")

Would simply sending the .tar.gz file to my colleague and simply running install() work? 是否只需将.tar.gz文件发送给我的同事并简单地运行install()工作?

Here is the DESCRIPTION file: 这是DESCRIPTION文件:

Package: HACSim
Type: Package
Title: Iterative simulation of species haplotype accumulation curves
Version: 1.0
Date: 2018-04-06
Author: Jarrett Phillips
Maintainer: Jarrett Phillips 
Description: Iterative simulation of species haplotype accumulation curves for assessment of sampling completeness
License: GPL (>= 3)
NeedsCompilation: Yes
Imports: ape (>= 5.0), 
     boot (>= 1.3-20), 
     investr (>= 1.4.0), 
     mgcv (>= 1.8-23), 
     pegas (>= 0.10), 
     Rcpp (>= 0.12.16), 
     scam (>= 1.2-2)
LinkingTo: Rcpp, 
           RcppArmadillo

and NAMESPACE 和NAMESPACE

useDynLib(HACSim, .registration=TRUE)
importFrom(Rcpp, evalCpp)
importFrom(ape, base.freq)
importFrom(ape, read.dna)
importFrom(boot, boot)
importFrom(boot, boot.ci)
importFrom(investr, predFit)
importFrom(MASS, mvrnorm) 
importFrom(mgcv, gam) 
importFrom(mgcv, gam.check)  
importFrom(mgcv, predict.gam)
importFrom(pegas, haplotype)
importFrom(rootSolve, uniroot.all)
importFrom(rootSolve, multiroot)
importFrom(scam, scam)
importFrom(scam, scam.check)
importFrom(scam, predict.scam)
exportPattern("^[[:alpha:]]+")

The error is 错误是

 The following packages are referenced using Rcpp::depends attributes \ 
 however are not listed in the Depends, Imports or LinkingTo fields of\ 
 the package DESCRIPTION file: RcppProgress

which seems plausible given what you now posted for DESCRIPTION and NAMESPACE. 考虑到您现在为DESCRIPTION和NAMESPACE发布的内容,这似乎是合理的。

So here is what I would do: 所以这是我会做的:

  1. Create the package using the skeleton generator as you have. 使用框架生成器创建包。 Extend as neeed as you have. 尽可能地扩展。 Then ... 然后 ...
  2. Run R CMD build mypackage then 然后运行R CMD build mypackage
  3. Run R CME check mypackage_1.2.3.tar.gz 运行R CME check mypackage_1.2.3.tar.gz

This should give you a clear idea as to whether your sources are in good shape. 这应该使您源是否处于良好状态有一个清晰的认识。 After that, you can create a binary or zip or ... which your colleague should be able to utilise. 之后,您可以创建一个二进制文件或zip或...,您的同事应该可以使用。

Edit: And you should of course grep for RcppProgress upon which you may indeed have an undeclared dependency. 编辑:当然,您应该为RcppProgress使用grep,您可能确实对它没有声明的依赖关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM