R dplyr: rowwise + mutate (+glue) - how to get/refer row content?
问题 The simple example of input data: dataset <- data.frame("part1" = c("a", "b", "c"), "part2" = c("x", "y", "z"), "caption" = c("{part1} {part2}", "{part2} {part1}", "{part2} {part1} {part2}"), stringsAsFactors = F) Expected results: # A tibble: 3 x 3 part1 part2 caption <chr> <chr> <chr> 1 a x a x 2 b y y b 3 c z z c z The below code doesn't work, because . refers to the whole dataset , instead of data of the whole row content: dataset %>% rowwise() %>% mutate("caption" = glue::glue_data(.,