2

A helpful sequence here (suppress comment "joining by..." when running dplyr::left_join) shows that you can suppress the message by explicitly stipulating the joining variable or by wrapping the whole dplyr block in suppressWarnings to get rid of this bleed through.

This is useful but I don't understand why neither "message=FALSE" nor "warning=FALSE" in an Rmarkdown code block header suppresses this message? The message seems somewhere between a message and a warning to judge by comments on it elsewhere but I would have thought we should be able to suppress the message with one of those block options.

I do understand the logic behind having the message when "by = " is not specified and I do know about suppressWarnings but wrapping dplyr blocks in anything seems a poor fit with the useful tidyverse syntax.

Is this worth a bug report or feature request? And if so, to whom: is the issue with how dplyr emits the message or with knit or somewhere else?

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
cpsyctc
  • 41
  • 5
  • You should post a reproducible example. – user2554330 Jun 11 '21 at 19:54
  • Wow. Thanks Ronak. I confess that at first I thought "Surely it doesn't need a reprex" but then I thought "No fair enough" ... and my first one didn't show the issue so I have discovered that it seems to be a side effect of pander. ```library(tidyverse) library(pander) bind_cols(letters[1:6], LETTERS[1:6]) %>% as_tibble() %>% rename(lwr = `...1`, upr = `...2`) -> tib1 bind_cols(letters[1:6], 1:6) %>% as_tibble() %>% rename(lwr = `...1`, numbers = `...2`) -> tib2 tib1 %>% left_join(tib2) %>% pander()``` – cpsyctc Jun 12 '21 at 20:29
  • Agh. Ran out of time trying to format that. Sorry, failed to format it again but I think if you cut and paste that into an Rmd file you will see what I mean with "Joining, by = “lwr”" bleeding through into the output which it doesn't without the use of pander. That probably explains why I couldn't find more about this. I should report to author of pander I guess. – cpsyctc Jun 12 '21 at 20:36

1 Answers1

0

For me, the best option is to set your by argument explicitly:

tib1 %>% 
    left_join(tib2, by = "lwr") %>%
    pander()

Alternately, use suppessMesseages:

suppressMessages(tib1 %>%
                   left_join(tib2) %>%
                   pander())
W. Joel Schneider
  • 1,711
  • 13
  • 14
  • 1
    I acknowledged that both were possible. However, you may, admittedly I think only occasionally, not know the intersect variables on which you will join in advance so occasionally the first is not possible and I continue to believe that in the tidyverse grammar, the latter is ugly and both surely sidestep the point that this is either a message or a warning so should be suppressed by the `message=FALSE, warning=FALSE` arguments in the Rmarkdown block header, which they are if `pander()` is not used, but which suppression is lost of it is used. I guess I should report it as a bug in pander. – cpsyctc Jun 20 '21 at 06:15