0

In the following tibble how to set the entries with only "-" to NA? I do not want to replace dash in entries like "1-2" with NA, only there where only dash is typed. I have a huge dataset so that would neet to apply to all columns and rows. Thanks!

data_fake <- data.frame(c("1","2","-","3","2","1"),c(1,2,3,4,5,6),c("2-3","3 bundles","4","5","-","1"))

data_fake <- as_tibble(data_fake)

data_fake %>%
        recode(.,"-", NA) 
MIH
  • 1,083
  • 3
  • 14
  • 26

0 Answers0