静默 StMoMo 包消息
silent StMoMo package messages
我正在使用 StMoMo 来拟合死亡率模型。目前我正在 RStudio 中进行 ioslies 演示。但是,我无法使包裹消息静音。
这是我的块:
```{r, verbose=FALSE, warning=FALSE, message=FALSE}
library(StMoMo)
Dxt <- EWMaleData$Dxt
Ext <- EWMaleData$Ext + 0.5 * EWMaleData$Dxt
ages <- EWMaleData$ages
years <- EWMaleData$years
ages.fit <- 55:89
wxt <- genWeightMat(ages = ages.fit, years = years, clip = 3)
LCfit <- fit(LC, Dxt = Dxt, Ext = Ext, ages = ages, years = years,
ages.fit = ages.fit, wxt = wxt)
```
但是我仍然在 knitr HTML 输出中得到以下信息:
## StMoMo: The following cohorts have been zero weigthed: 1872 1873 1874 1954 1955 1956
## StMoMo: Start fitting with gnm
## Initialising
## Running start-up iterations..
## Running main iterations.....
## Done
## StMoMo: Finish fitting with gnm
有什么想法可以去除这些信息,但仍然评估代码吗?
只需在 fit
函数中将参数 verbose = FALSE
添加到静默 StMoMo,即
LCfit <- fit(LC, Dxt = Dxt, Ext = Ext, ages = ages, years = years,
ages.fit = ages.fit, wxt = wxt, verbose = FALSE)
我正在使用 StMoMo 来拟合死亡率模型。目前我正在 RStudio 中进行 ioslies 演示。但是,我无法使包裹消息静音。
这是我的块:
```{r, verbose=FALSE, warning=FALSE, message=FALSE}
library(StMoMo)
Dxt <- EWMaleData$Dxt
Ext <- EWMaleData$Ext + 0.5 * EWMaleData$Dxt
ages <- EWMaleData$ages
years <- EWMaleData$years
ages.fit <- 55:89
wxt <- genWeightMat(ages = ages.fit, years = years, clip = 3)
LCfit <- fit(LC, Dxt = Dxt, Ext = Ext, ages = ages, years = years,
ages.fit = ages.fit, wxt = wxt)
```
但是我仍然在 knitr HTML 输出中得到以下信息:
## StMoMo: The following cohorts have been zero weigthed: 1872 1873 1874 1954 1955 1956
## StMoMo: Start fitting with gnm
## Initialising
## Running start-up iterations..
## Running main iterations.....
## Done
## StMoMo: Finish fitting with gnm
有什么想法可以去除这些信息,但仍然评估代码吗?
只需在 fit
函数中将参数 verbose = FALSE
添加到静默 StMoMo,即
LCfit <- fit(LC, Dxt = Dxt, Ext = Ext, ages = ages, years = years,
ages.fit = ages.fit, wxt = wxt, verbose = FALSE)