Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:在C+中抑制来自Rprintf的消息+; 我写了一个R包,其中有些C++代码运行冗长的计算。在C++代码中,我使用RPrimtf*()来输出信息。我尝试使用suppressMessages()抑制R的输出,但这不起作用,消息仍然显示在R会话中_C++_R_Printf_Suppress - Fatal编程技术网

R:在C+中抑制来自Rprintf的消息+; 我写了一个R包,其中有些C++代码运行冗长的计算。在C++代码中,我使用RPrimtf*()来输出信息。我尝试使用suppressMessages()抑制R的输出,但这不起作用,消息仍然显示在R会话中

R:在C+中抑制来自Rprintf的消息+; 我写了一个R包,其中有些C++代码运行冗长的计算。在C++代码中,我使用RPrimtf*()来输出信息。我尝试使用suppressMessages()抑制R的输出,但这不起作用,消息仍然显示在R会话中,c++,r,printf,suppress,C++,R,Printf,Suppress,我发现了一些类似的问题,人们使用printf而不是Rprintf,但我已经在使用Rprintf了。我还尝试了R_ShowMessage(),它也会立即显示,而不会被suppressMessages()抑制 这里有一些C++代码: #include <R.h> extern "C" { void R_testprint() { Rprintf("Try to suppress me!\n"); R_ShowMessage("Try to suppress me, too

我发现了一些类似的问题,人们使用printf而不是Rprintf,但我已经在使用Rprintf了。我还尝试了R_ShowMessage(),它也会立即显示,而不会被suppressMessages()抑制

这里有一些C++代码:

#include <R.h>
extern "C" {
void R_testprint()
{
    Rprintf("Try to suppress me!\n");
    R_ShowMessage("Try to suppress me, too!");
}
}
我使用的是R版本3.1.0


谢谢你的帮助

使用
capture.output
代替
suppressMessages

 b <- capture.output( test.print() )

<代码> B,你能给我们C++代码吗?我想使用SuffSimScript,因为这是这个代码的任何用户都能做的。代码是R包的一部分,因此任何用户都会使用suppressMessages来抑制输出。如果输出需要是data.frame而不是字符向量,该怎么办?
> suppressMessages( test.print() )
Try to suppress me!
Try to suppress me, too!
 b <- capture.output( test.print() )