powered by
Recode Values as NA if they meet defined criteria
recode_as_na_for(df, criteria = "gt", value = 0, subset_cols = NULL)
A data.frame object to manipulate
One of gt,gteq,lt,lteq to define greater than, greater than or equal to, less than or less than or equal to.
The value to convert to `NA`. We can for instance change "n/a" to `NA` or any other value.
An optional character vector for columns to manipulate.
A data.frame object with the required changes.
# NOT RUN { recode_as_na_for(airquality,value=36, criteria = "gteq", subset_cols = c("Ozone","Solar.R")) # }
Run the code above in your browser using DataLab