powered by
Zero NA values in a data.frame, including cols and exluding ignore. Also does not replace Date or POSIXt fields.
cols
ignore
Date
POSIXt
zero_na(x, cols = names(x), ignore = character(), verbose = FALSE, na_ish = TRUE, new_val = 0)
data.frame
names of columns to work on, default is all columns
character vector of columns names to ignore
TRUE or FALSE
Logical, default `TRUE` which will convert NA-like strings, too
`0`
# NOT RUN { d <- data.frame(1:5, 6:10, 11:15) d[2, 3] <- NA d[5, 2] <- NA d[1, 1] <- NA print(d) zero_na(d) d[1, 1] <- "NA" zero_na(d, na_ish = TRUE) # }
Run the code above in your browser using DataLab