抑制 R 中的进度条

Suppress a progress bar in R

R的eHOF包中的HOF函数自动生成进度条。函数中没有参数来关闭进度条。

有没有办法在函数外抑制进度条的生成? (我已经应用了数百次该功能,目前进度条除了淹没我的屏幕外没有任何作用。)

根据@hrbrmstr 的建议。

# Load the library
library("eHOF")

# Generate a fake dataset
FakeData<-sample(c(0,1),250,replace=TRUE)
TestMatrix<-matrix(FakeData,nrow=50,ncol=5)

# Apply the HOF function to each column of the matrix, and suppress progbar
# Use invisible to prevent capture.output from printing the progbar
invisible(capture.output(Models<-apply(TestMatrix,2,HOF,1:50)))

# Apply the Para function to extract the model parameters
DesiredOutcome<-sapply(Models,Para)