Merge rows in tibble
We can replace blank with NA
values, use fill
to replace NA
with previous value in Function
column, group_by
Function
and create one concatenated string for each Function
.
library(dplyr)
package_info_tbl %>%
na_if('') %>%
tidyr::fill(Function) %>%
group_by(Function) %>%
summarise(Title = paste(Title, collapse = " "))
# A tibble: 12 x 2
# Function Title
# <chr> <chr>
# 1 [[.fseq Extract function(s) from a functional sequence.
# 2 %<>% magrittr compound assignment pipe-operator
# 3 %>% magrittr forward-pipe operator
# 4 %$% magrittr exposition pipe-operator
# 5 %T>% magrittr tee operator
# 6 debug_fseq Debugging function for functional sequences.
# 7 debug_pipe Debugging function for magrittr pipelines.
# 8 extract Aliases
# 9 freduce Apply a list of functions sequentially
#10 functions Extract the function list from a functional sequence.
#11 magrittr magrittr - Ceci n'est pas un pipe
#12 print.fseq Print method for functional sequence.