na.replace {gtools} | R Documentation |
Replace missing values
na.replace(x, replace)
x |
vector possibly contining missing ( |
replace |
scalar replacement value |
This is a convenience function that is the same as x[is.na(x)] <- replace
Vector with missing values (NA
) replaced by the
value of replace
.
Gregory R. Warnes greg@warnes.net
x <- c(1,2,3,NA,6,7,8,NA,NA) na.replace(x, '999')