Is there a more laconic way to do the same without spread-mutate-gather lines?
library(tidyverse) tibble(cola = letters[1:3], colb = 1:3) %>% spread(cola, colb) %>% mutate(d = c + 1) %>% gather(cola, colb) #> # A tibble: 4 x 2 #> cola colb #> <chr> <dbl> #> 1 a 1 #> 2 b 2 #> 3 c 3 #> 4 d 4
Created on 2019-02-05 by the reprex package (v0.2.1)
I mean, to add one more row based on a previous one. Let's call it "mutate for rows".
When I say "laconic", I mean in no more than 3 lines and still staying in the pipeline, without intermediate assignments.