I’m trying to turn this operation into a function where I could set the n argument and without using for loop. This example is for 3 times. I thought I could do it with purrr::reduce but it needs a list (?).
tibble::add_row(tibble::add_row(tibble::add_row(df, .before = 1), .before = 1), .before = 1)
>Solution :
reduce(rep(list(add_row), 3), ~.y(.x, .before = 1), .init =df)
x y
1 NA NA
2 NA NA
3 NA NA
4 1 3
5 2 4