AW: [R] pmatch questions

"Unternährer Thomas, uth" uth at zhwin.ch
Thu Oct 2 11:19:09 CEST 2003


Hi,

This is maybe not a really nice solution but it gives you what you want

which(regexpr("a", c("cc","xxa"))!=-1)
2

which(regexpr("xx", c("cc","xxa","xxb"))!=-1)
2 3

HTH

Thomas


-----Ursprüngliche Nachricht-----
Von: Vito Muggeo [mailto:vito.muggeo at giustizia.it] 
Gesendet: Donnerstag, 2. Oktober 2003 11:04
An: r-help at stat.math.ethz.ch
Betreff: [R] pmatch questions


Dear all,
Below there are two, simple - I suppose, questions on using pmatch():

> pmatch("xx", c("cc","xxa"))
[1] 2
> pmatch("a", c("cc","xxa"))
[1] NA
> pmatch("xx", c("cc","xxa","xxb"))
[1] NA

I would like that the second call returns also 2, and the third call returns
c(2,3)
is it possible?

many thanks
vito

______________________________________________
R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list