【发布时间】:2014-03-26 16:50:34
【问题描述】:
我学习了如何检测时间序列中的异常,我使用来自TSA 包的detectAO 和detectIO 函数。我在循环中使用它们,但它们的输出没有被抑制。据我所知,当您在循环或函数中使用某些函数时,它们的输出会被抑制,直到您使用 print() 函数。于是查看了这些函数的源码,作者使用了print()。有什么方法可以在不使用sink('/dev/null') 的情况下抑制此输出?
require(TSA)
detected<-numeric(1000)
for(i in 1:10){
data<-rcauchy(1000)
model<-auto.arima(data)
#I don't want this to be printed
detected<-detectAO(model)$ind
#Only this
print(detected)
}
【问题讨论】:
-
你能发布一些最小的可重现代码吗?
标签: r