You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
347B

  1. list_transpose_bind <- function(x) {
  2. purrr::reduce(x, list_transpose_bind_impl)
  3. }
  4. list_transpose_bind_impl <- function(x, acc) {
  5. if (!length(x)) return(acc)
  6. for (name in names(x)) {
  7. if (!name %in% names(x)) {
  8. acc[[name]] <- x[[name]]
  9. } else {
  10. acc[[name]] <- dplyr::bind_rows(acc[[name]], x[[name]])
  11. }
  12. }
  13. acc
  14. }