Running RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for Ubuntu Bionic
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36
I cannot suppress a message from the predict command, which is quite irritating. It always wants to tell me what sort of interpolation it is doing.
Here is my reprex:
df_temp <- as_tibble(replicate(3,sample(0:100,10,rep=TRUE))) %>% rename(x=1, y=2, z=3)
df_temp <- sf::st_as_sf(df_temp, coords=c("x", "y"), agr = "identity")
df_out <- sf::st_sfc(sf::st_point(c(50,50)))
fit_IDW <- gstat::gstat(
formula = z ~ 1,
data = df_temp,
set = list(idp = 1)
)
interp_IDW <- predict(fit_IDW, df_out)
suppressMessages(interp_IDW <- predict(fit_IDW, df_out))
[inverse distance weighted interpolation]
[inverse distance weighted interpolation]
cderv
September 20, 2022, 1:50pm
2
you have chunk option like message = FALSE
or warning = FALSE
This book showcases short, practical examples of lesser-known tips and tricks to helps users get the most out of these tools. After reading this book, you will understand how R Markdown documents are transformed from plain text and how you may...
But it all depends how the predict
function is outputing this message. If they use cat()
for example, then it will be harder - capture.output()
should be helpful here.
But in that case, they should use message instead. Can you look into gstat code, or report to them that using suppressMessages
or message = FALSE
is not working ?
Reported on gstat git site, edzer recommended setting debug.level = 0
, which mostly worked.
For gstat.cv additionally the option verbose=FALSE needs to be set.
1 Like
cderv
September 21, 2022, 12:18pm
4
It sounds like a good solution !
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:
If your question has been answered, don't forget to mark the solution!
How do I mark a solution?
Find the reply you want to mark as the solution and look for the row of small gray icons at the bottom of that reply. Click the one that looks like a box with a checkmark in it:
[image]
Hovering over the mark solution button shows the label, "Select if this reply solves the problem". If you don't see the mark solution button, try clicking the three dots button ( ••• ) to expand the full set of options.
When a solution is chosen, the icon turns green and the hover label changes to: "Unselect if this reply no longer solves the problem". Success!
[solution_reply_author]
…
system
Closed
September 28, 2022, 12:18pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.