简体   繁体   English

在包中包括已归档的CRAN包

[英]Include archived CRAN package in package

I'm creating an R package, and I would like to rely on the falsy package, which has recently been archived from CRAN. 我正在创建一个R包,我想依靠最近从CRAN 存档falsy包。

With a non-archived package, one would typically add the name of the package to the Imports list in the DESCRIPTION file. 对于未归档的程序包,通常会将程序包的名称添加到DESCRIPTION文件的“ Imports列表中。 How does one import a package that's been archived by CRAN? 如何导入由CRAN存档的软件包?

Note: After contacting Gábor it seems the reason falsy is archived is due to potentially dangerous inconsistencies between native and falsy notions of falsehood. 注意:与Gábor联系后,似乎伪造档案的原因是本机和falsy之间潜在的危险不一致 He does not plan to unarchive the package. 他不打算取消归档包。

This: 这个:

FALSY <- FALSE

TRUTHY <- TRUE

is_falsy <- function(object) {
  is.null(object) ||
    identical(object, FALSE) ||
    identical(object, 0L) ||
    identical(object, 0.0) ||
    identical(object, 0+0i) ||
    identical(object, "") ||
    identical(object, as.raw(0)) ||
    identical(object, logical()) ||
    identical(object, integer()) ||
    identical(object, double()) ||
    identical(object, complex()) ||
    identical(object, character()) ||
    identical(object, raw()) ||
    identical(object, list()) ||
    inherits(object, "try-error")
}

is_truthy <- function(object) {
  ! is_falsy(object)
}

`%&&%` <- function(lhs, rhs) {
  lres <- withVisible(eval(lhs, envir = parent.frame()))
  if (is_truthy(lres$value)) {
    eval(rhs, envir = parent.frame())
  } else {
    if (lres$visible) { lres$value } else { invisible(lres$value) }
  }
}

nay <- function(rhs) {
  if (is_falsy(rhs)) { TRUTHY } else { FALSY }
}

try_quietly <- function(expr) {
  try(expr, silent = TRUE)
}

is the entire extent (minus roxygen comments) of the package. 是包装的整个范围 (减去氧气含量)。 Why not just include it in your package? 为什么不将其包含在您的包装中?

Failing that, possibly ask Gabor if he's planning re-releasing it to CRAN or if you could take over maintenance? 失败了,可能会问Gabor,他是否打算将其重新发行给CRAN,或者您是否可以接管维护工作?

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

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