Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

dplyr (version 0.4.1) prints the colnames by which it is performing the join. Is it possible to turn this option off?

R code:

library(dplyr)
a=data.frame(x=1,y=2)
b=data.frame(x=1,z=10)
aa=inner_join(a,b)

for the last line, dplyr prints:

Joining by: "x"

that is nice for interactive work, but I am running in Rscript and all these lines are clogging my screen.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
577 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you want to be heavy-handed, you can do

aa = suppressMessages(inner_join(a, b))

The better choice, as Jazzurro suggests, is to specify the by argument. dplyr only prints a message to let you know what its guess is for which columns to join by. If you don't make it guess, it doesn't confirm things with you. This is a safer choice as well, from defensive coding standpoint.

If this is in a knitr document, you can set the chunk option message=FALSE.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...