amvillegas / StMoMo

Stochastic Mortality Modelling
22 stars 6 forks source link

Suppress messages related to the fit() function #15

Closed mpascariu closed 6 years ago

mpascariu commented 6 years ago

Hi Andreas,

Is there a way to suppress the messages printed during the fitting of a model?

Example:

> M3  <- fit(lc(), Dxt = Dx, Ext = Ex, ages = x, 
+            years = y, ages.fit = x, wxt = wxt)

StMoMo: The following cohorts have been zero weigthed: 1850 1851 1852 2014 2015 2016 
StMoMo: Start fitting with gnm
Initialising
Running start-up iterations..
Running main iterations...........................................
Done
StMoMo: Finish fitting with gnm

suppressMessages() does not work because you are using cat() in your code to display messages.

Thanks! Marius

amvillegas commented 6 years ago

Yes, you can suppress messages with argument verbose = FALSE in function fit. So this should work

M3 <- fit(lc(), Dxt = Dx, Ext = Ex, ages = x, years = y, ages.fit = x, wxt = wxt, verbose = FALSE)

mpascariu commented 6 years ago

Great. Thanks.