test<-c("20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL",
"20120111_181516_002_CCL54D_A02_S08_APL932_PL11_DL_20120111.CEL")

> test
[1] "20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL"
[2] "20120111_181516_002_CCL54D_A02_S08_APL932_PL11_DL_20120111.CEL"

fields1<-strsplit(test, "_")

> fields1
[[1]]
 [1] "20120111"     "181515"       "001"          "CCL54D"
"A01"
 [6] "S02"          "APL932"       "PL11"         "DL"
"20120111.CEL"

[[2]]
 [1] "20120111"     "181516"       "002"          "CCL54D"
"A02"
 [6] "S08"          "APL932"       "PL11"         "DL"
"20120111.CEL"

> *releaseqc<-sapply(fields1, "[",4)*

 releaseqc
[1] "CCL54D" "CCL54D"

_____________
Dear R community,

I used the *releaseqc<-sapply(fields1, "[",4)* to get the 4th elements from
each sub-list within fields1 list.

How do I get the first non-digital or first character element from each
list?

Thanks!





-- 
Sincerely,
Changbin
--

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to