I'm playing with a .csv file that has some "unknown" values that I have to clear in R. For example, column A has variables "yes", "no", and "unknown"
How can I get rid of the "unknown" variables using R code.
I'm playing with a .csv file that has some "unknown" values that I have to clear in R. For example, column A has variables "yes", "no", and "unknown"
How can I get rid of the "unknown" variables using R code.
As far as I got your questions you try to define Cellvalues that are "unknown" as an NA in your data frame. You can do this by setting the na.string
in your read.csv()
function.
df <- read.csv(file, na.strings = "unknown")
and that's it! Now you should have a new data frame that declares "unknown" as NA.