问题描述
Based on this Q&A,此代码定义了一个包含对值1进行有效绑定的包。它传递devtools::check()
:
my_function <- function() 1
#' return 1
#' @usage my_active_binding
#' @name my_active_binding
NULL
.onLoad <- function(libname,pkgname) {
ns <- asNamespace(pkgname)
makeActiveBinding("my_active_binding",my_function,env = ns)
namespaceExport(ns,"my_active_binding")
}
但是,如果默认情况下我的活动绑定失败(在我的用例中,它应在特定的上下文中使用),
则devtools::check()
不再快乐。
编辑:实际上,如果我使用print()
或message()
而不是stop()
,则会遇到相同的问题
my_function <- function() stop("stop!!!")
#' stop!!!
#' @usage my_active_binding
#' @name my_active_binding
NULL
.onLoad <- function(libname,"my_active_binding")
}
请参见下文:
-- R CMD check results ---------------------------------- abtest 0.0.0.9000 ----
Duration: 21s
> checking DESCRIPTION Meta-@R_713_4045@ion ... WARNING
Non-standard license specification:
GPL3
Standardizable: FALSE
> checking S3 generic/method consistency ... WARNING
Error in (function () : stop!!!
Calls: <Anonymous> -> Filter -> unlist -> lapply -> FUN -> <Anonymous>
Ex�cution arr�t�e
See section 'Generic functions and methods' in the 'Writing R
Extensions' manual.
> checking for code/documentation mismatches ... WARNING
Error in (function () : stop!!!
Calls: <Anonymous> ... Filter -> unlist -> lapply -> FUN -> get -> <Anonymous>
Ex�cution arr�t�e
> checking dependencies in R code ... NOTE
Error in (function () : stop!!!
Ex�cution arr�t�e
> checking foreign function calls ... NOTE
Error in (function () : stop!!!
Calls: <Anonymous> -> lapply -> FUN -> get -> <Anonymous>
Ex�cution arr�t�e
See chapter 'System and foreign language interfaces' in the 'Writing R
Extensions' manual.
> checking R code for possible problems ... NOTE
Error in (function () : stop!!!
Calls: <Anonymous> ... withCallingHandlers -> do.call -> <Anonymous> -> get -> <Anonymous>
Ex�cution arr�t�e
> checking Rd \usage sections ... NOTE
Error in (function () : stop!!!
Calls: <Anonymous> ... Filter -> unlist -> lapply -> FUN -> get -> <Anonymous>
Ex�cution arr�t�e
The \usage entries for S3 methods should use the \method markup and not
their full name.
See chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.
0 errors v | 3 warnings x | 4 notes x
Erreur : R CMD check found WARNINGs
Ex�cution arr�t�e
Exited with status 1.
我该怎么做才能将此活动绑定集成到我的软件包中并满足devtools::check()
/ R CMD检查?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)