简体   繁体   English

在构建小插图时如何考虑 package 的自定义 arguments?

[英]How to consider custom arguments of a package while building vignette?

I have a package which requires some custom arguments for installation.我有一个 package 需要一些自定义 arguments 进行安装。 I can use R CMD INSTALL ---configure-args=... pkg.tar.gz to install the package successfully.我可以使用R CMD INSTALL ---configure-args=... pkg.tar.gz成功安装 package。 I can also use R CMD check --install-args=configure-args=... to check the package after getting the custom arguments. I can also use R CMD check --install-args=configure-args=... to check the package after getting the custom arguments. However, R CMD build doesn't have any arguments like --install-args and/or configure-args and R CMD build is used for building vignettes. However, R CMD build doesn't have any arguments like --install-args and/or configure-args and R CMD build is used for building vignettes. I want to get the output of my R code chunks included in the vignette to its html output file and include it in the package source. I want to get the output of my R code chunks included in the vignette to its html output file and include it in the package source. Is there any way possible to build vignette with --configure-args or is there any workaround to produce the desired html vignette and include it in the package source?是否有任何方法可以使用--configure-args构建小插图,或者是否有任何解决方法来生成所需的 html 小插图并将其包含在 package 源中?

Looking forward to your suggestions.期待您的建议。

As you say, when R CMD build rebuilds your vignettes, it doesn't include a way to specify --include-args , so the temporary install needs to work with default settings.正如您所说,当R CMD build重建您的小插曲时,它不包括指定--include-args的方法,因此临时安装需要使用默认设置。

There are two ways to achieve this.有两种方法可以实现这一点。 You could specify --no-build-vignettes .您可以指定--no-build-vignettes This would require that you have already put the built vignettes into the inst/doc directory, and R CMD build will just use what's there.这将要求您已经将构建的小插图放入inst/doc目录,并且R CMD build将只使用那里的内容。

The other way is to make sure that on your machine the default configuration works.另一种方法是确保在您的机器上使用默认配置。 If you need to build on several different machines, this could be achieved by having your build script look at environment variables to find default settings if corresponding configure arguments aren't given.如果您需要在几台不同的机器上构建,如果没有给出相应的配置 arguments,则可以通过让构建脚本查看环境变量以查找默认设置来实现这一点。 Then on each machine you specify the environment variables for R CMD build to see, eg然后在每台机器上为R CMD build指定环境变量以查看,例如

DEFAULT_LOCATION="/some/dir" R CMD build yourpackage

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

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