[R] Cannot get "==" operator to return TRUE
gsee000 at gmail.com
Fri Feb 3 17:10:06 CET 2012
Thank you! That is great.
Do you know of a way to print a string such that I can see whether it
contains a string or a no-break space?
On Fri, Feb 3, 2012 at 10:01 AM, Petr Savicky <savicky at cs.cas.cz> wrote:
> On Fri, Feb 03, 2012 at 09:25:10AM -0600, G See wrote:
>> I have a data.frame named "df". The dput of df is at the bottom of this e-mail.
>> What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it works
>> to do this:
>> df[df == "n/a"] <- NA
>> However, it does not work on Ubuntu. See below.
>> Thanks in advance,
>> > x <- df[27, 4] # complete data.frame dput is below
>> > dput(x)
>> "n/a "
> This string contains a no-break space, not a space.
> "n/a " == "n/a\uA0"
>  TRUE
>  "n/a "
> Hope this helps.
> Petr Savicky.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help