Skip to content
Prev 323996 / 398503 Next

How to test if something doesn't exist

#Some cases: 

ifelse(blah!="xyz",paste0(blah,1),blah)
#[1] "x11" "x21" "x31" "x41" "x51"

if(sum(blah=="xyz")>0) blah else paste0(blah,1)
#[1] "x11" "x21" "x31" "x41" "x51"

if(any(blah=="xyz")) blah else as.numeric(factor(blah))
#[1] 1 2 3 4 5
A.K.






----- Original Message -----
From: Joseph Trubisz <jtrubisz at me.com>
To: arun <smartpink111 at yahoo.com>
Cc: 
Sent: Wednesday, May 22, 2013 2:37 PM
Subject: Re: [R] How to test if something doesn't exist

OK...got it...thanks....

Joe
On May 22, 2013, at 2:34 PM, arun <smartpink111 at yahoo.com> wrote: