How to set missing values in R




I have a file in which missing values are coded as ?
How do I manipulate the data so that the rows with these missing values are removed??


I would use gsub and use the escape character

> b=gsub("\\?","",a)
> b
[1] ""   "A"  "23" "56"

Note i used two \ to escape the special characters @shuvayan


thanks a lot @ajay_ohri sir :smiley:


@shuvayan Also, read.table (and hence, read.csv) has an argument called na.strings to which one must assign one or more (a vector) strings which are to be considered NA values. After that’s it’s just a case of subsetting the original data-set appropriately.