I can see that situation as not needing a return.
I am thinking about a situation where I have to print the object anyway -- for example:
some_func <- function(df, new_names) {
names(df) <- new_names
df
}
vs.
some_func <- function(df, new_names) {
names(df) <- new_names
return(df)
}
To me, the second function seems much clearer - so I'm surprised that the style guide would tell me not to -- but maybe I am just weird
. I do see why preferring return would be cumbersome when the end of a function is primarily one long chain of %>%s
(and yes, I am aware of set_names() that does my some_func already
)