First, many thanks Jeff for your package, I think it is amazing! What it comes next is meant to be a suggestion.
The "Multistart %d of %d %c" feature that is present in many np functions is very useful to keep track of the execution in regular R sessions. However, it can be cumbersome when dealing with R markdown documents. This is because it seems to be no verbose flag to deactivate the messages neither they are removed via suppressMessages.
Therefore, an R Markdown chunk like this
```{r, message = FALSE}
# Dummy data
X <- rnorm(50)
Y <- 1 + 2 * X + rnorm(50, sd = 0.1)
# Lots of screen outputs
bw1 <- np::npregbw(formula = Y ~ X)
suppressMessages(bw2 <- np::npregbw(formula = Y ~ X))
# Removing screen information
a <- capture.output(bw3 <- np::npregbw(formula = Y ~ X))
```
results in
# Dummy data
X <- rnorm(50)
Y <- 1 + 2 * X + rnorm(50, sd = 0.1)
# Lots of screen outputs
bw1 <- np::npregbw(formula = Y ~ X)
##
Multistart 1 of 1 |
Multistart 1 of 1 |
Multistart 1 of 1 |
Multistart 1 of 1 /
Multistart 1 of 1 |
Multistart 1 of 1 |
suppressMessages(bw2 <- np::npregbw(formula = Y ~ X))
##
Multistart 1 of 1 |
Multistart 1 of 1 |
Multistart 1 of 1 |
Multistart 1 of 1 /
Multistart 1 of 1 |
Multistart 1 of 1 |
# Removing screen information
a <- capture.output(bw3 <- np::npregbw(formula = Y ~ X))
which is not very nice for producing a pdf document (and especially if the number of multistarts is larger).
In my view, two alternative possibilities for improving the np +knitr experience could be:
Add a verbose flag to functions printing "Multistarts" to deactivate those messages.
Rely on a message system that is suppressible via knitr's message = FALSE.
The workaround based on capture.output exposed above works, but that has an impact on the readability of the code.
First, many thanks Jeff for your package, I think it is amazing! What it comes next is meant to be a suggestion.
The
"Multistart %d of %d %c"
feature that is present in manynp
functions is very useful to keep track of the execution in regular R sessions. However, it can be cumbersome when dealing with R markdown documents. This is because it seems to be noverbose
flag to deactivate the messages neither they are removed viasuppressMessages
.Therefore, an R Markdown chunk like this
results in
which is not very nice for producing a pdf document (and especially if the number of multistarts is larger).
In my view, two alternative possibilities for improving the
np
+knitr
experience could be:verbose
flag to functions printing "Multistarts" to deactivate those messages.knitr
'smessage = FALSE
.The workaround based on
capture.output
exposed above works, but that has an impact on the readability of the code.