[R] List filtration

Johannes Graumann johannes_graumann at web.de
Thu Feb 22 15:33:14 CET 2007

Hello R-ologists,

Imagine you have a list "list" like so:

[1] "IPI00776145.1" "IPI00776187.1"

[1] "Something" "IPI00807764.1" "IPI00807887.1"

[1] "IPI00807764.1"

[1] "Somethingelse"

What I need to achieve is a filtered list "list2" like so:

[1] "IPI00776145.1"

[1] "IPI00807764.1"

[1] "IPI00807764.1"

- if sublist-entry 1 start with "^IPI" make it the list-entry.
- otherwise chose the first "^IPI" sublist-entry present.
- delete the list-entry if not "^IPI" sublist-entry present.

Can anybody nudge me towards an elegant solution without looping - I have
LOTS of entries to process ...

Thanks for your Teachings,


More information about the R-help mailing list