dnesday, May 22, 2013 2:09 PM
To: r-help@r-project.org
Subject: [R] How to test if something doesn't exist
Couldn't exactly explain the subject, so here's the example:
idx<-which(blah[,1]=="xyz")
idx
integer(0)
How do I test that idx has a valid value (namely, > 0)?
TiA,
"
if(any(blah=="xyz")) blah else as.numeric(factor(blah))
#[1] 1 2 3 4 5
A.K.
----- Original Message -----
From: Joseph Trubisz
To: arun
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 M
- Original Message -
From: Joseph Trubisz
To: r-help@r-project.org
Cc:
Sent: Wednesday, May 22, 2013 2:08 PM
Subject: [R] How to test if something doesn't exist
Couldn't exactly explain the subject, so here's the example:
idx<-which(blah[,1]=="x
Couldn't exactly explain the subject, so here's the example:
idx<-which(blah[,1]=="xyz")
idx
integer(0)
How do I test that idx has a valid value (namely, > 0)?
TiA,
Joe
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
4 matches
Mail list logo