从R中的as.function()抑制警告

时间:2020-09-09 16:21:29

标签: r

在R中,我使用mpoly包定义函数,带有输出的最小示例是

> library(mpoly)
> b_1=as.function(bernstein(1,1))
f(.) with . = x

理想情况下,我想运行此功能,以使没有输出(请注意控制台中的输出为红色,与警告的颜色相同)

f(.) with . = x

我尝试了以下方法

> b_1=suppressWarnings(as.function(bernstein(1,1)))
> b_1=invisible(as.function(bernstein(1,1)))

> options(warn=-1)
> b_1 = as.function(bernstein(1,5))
> options(warn=0)

任何想法都将不胜感激。

1 个答案:

答案 0 :(得分:0)

尝试以下

b_1=as.function(bernstein(1,1),silent=TRUE)
相关问题