0

I am using following command to replace '?' with NA but not able to do so.

I want to replace '?' with NA and then omit the rows

my_data[my_data == '?'] <- NA
good_data <- na.omit(my_data)
thelatemail
  • 91,185
  • 12
  • 128
  • 188
AmitG
  • 11
  • 4
  • Why not use `na.strings = "?"` in `read.csv/read.table` In the current code, may be you have some lagging/leading spaces. What is the output of `my_data == "?"` Is there any `TRUE` elements – akrun Jun 17 '19 at 03:03
  • @amitg have you seen this [post](https://stackoverflow.com/questions/4862178/remove-rows-with-all-or-some-nas-missing-values-in-data-frame)? – mnm Jun 17 '19 at 03:17
  • @akrun There is no true element with table command. but it is there in dataset. how to identify '?' in the dataset? – AmitG Jun 17 '19 at 03:28
  • @akrun how i can read the '?' sign from data to be true? – AmitG Jun 17 '19 at 03:39
  • @AmitG Edit your post to contain the output of `head(my_data)` and `dput(head(my_data))` . That way, we have a better understanding of what your data looks like. Please ensure that one of the rows with '?' is present in your sample – Rohit Jun 17 '19 at 06:10

0 Answers0