R/fill_in_empty_rows.R

Defines functions fill_in_empty_rows

fill_in_empty_rows <- function(df) {

  for (i in 1:ncol(df)) {

    x <- df %>%
      select(i) %>%
      distinct() %>%
      pull

    l <- length(x)

    if (l > 1 & NA %in% x) {

      df <- df %>%
        fill(i,.direction = 'down')

    } else {

      next()

    }

  }

  return(df)
}
neugelb/neugelbtools documentation built on July 7, 2020, 1:17 a.m.