found \N in my data does not count as missing values in r So scrolling through my columns I find \N embedded. I need to count them, but I get an error.  Would it be considered a missing value, it's new to me.

# Check whether attribute HeadOfState in country has any missing values, and if so, how many.
country$headOfState[country$headOfState==""] &lt;- NA
country$headOfState[country$headOfState==\N] &lt;- NA
sum(is.na(country$headOfState))

# Check whether attribute IndepYear in country has any missing values, and if so, how many.
country$IndepYear[country$indepYear==""] &lt;- NA
country$indepYear[country$indepYear=='\N'] &lt;- NA
sum(is.na(country$indepYear))


Error: unexpected input in "country$headOfState[country$headOfState==\"


  country$headOfState[country$headOfState==\N] &lt;- NA
  Error: unexpected input in "country$headOfState[country$headOfState==\"
The reason its shorws an error, bacause '\' is a part of base regex expressions in R.
As states here: 

The metacharacters in extended regular expressions are . \ | ( ) [ { ^ $ * + ?

So the comparisson like this

country$indepYear=='\N'


or this ( Its not a valid comparisson at all)

country$headOfState==\N 


will throw an error. You need to "escape" the "\" symbol. 
Try something like this instead if you want to replace "\N" with NA:

country$indepYear[country$indepYear=='\\N'] &lt;- NA


If you need just to count them, you can use this approach:

sum(country$indepYear=='\\N') 


Hope this helps.