4 ms·
Alternatively, x %>% bind_cols(y, z) %>% as.tibble() %>% na.omit() Makes the order of execution a little clearer (and uses more dplyr co
by confounded 9y ago
Alternatively,
x %>%
bind_cols(y, z) %>%
as.tibble() %>%
na.omit()
Makes the order of execution a little clearer (and uses more dplyr conventions). I still nest functions when working interactively with a REPL, but for code I'll have to reread in the future, the pipes save me much head scratching. Death to the pyramid of doom.
- tincholio 9y agoThat's indeed a nicer style
- minimaxir 9y agoFor emphasis, bind_cols is a dplyr function (meaning it gets the speed boost from using Rcpp, albeit not much difference when adding a few columns), while cbind is a base function which does not. dplyr nowadays obsoletes most of the basic building blocks of data frame construction, although they are hidden in the docs.