Thanks so much, David! I will try.
On Thu, Feb 9, 2012 at 3:04 PM, David Winsemius <[email protected]>wrote: > > On Feb 9, 2012, at 5:01 PM, Changbin Du wrote: > > 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? >> > > Perhaps something like: > > mapply ( "[", fields1, sapply(fields1, function(x) { which.min( is.na( > is.numeric(fields1))) } > > There are certainly other grep()-ish ways of approaching this. > > -- > > David Winsemius, MD > West Hartford, CT > > -- Sincerely, Changbin -- Changbin Du Data Analysis Group, Affymetrix Inc 6550 Emeryville, CA, 94608 [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.

