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.
With a non-archived package, one would typically add the name of the package to the Imports
list in the DESCRIPTION
file. How does one import a package that's been archived by 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. 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?
链接地址: http://www.djcxy.com/p/60076.html上一篇: Fontforge脚本如何为字形添加连字
下一篇: 包含归档的CRAN软件包