I want to substitute whitespaces with NA. A simple way could be df[df == \"\"] <- NA, and that works for most of the cells of my data frame....but not for ev
df[df == \"\"] <- NA
I just spent some time trying to determine a method usable in a pipe.
Here is my method:
df <- df %>% dplyr::mutate_all(funs(sub("^\\s*$", NA, .)))
Hope this helps the next searcher.