How to make a list as below
2
0
Entering edit mode
@li-aiguo-nihnci-828
Last seen 10.2 years ago
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20070724/ ab40e1f6/attachment.pl
• 1.3k views
ADD COMMENT
0
Entering edit mode
@benilton-carvalho-1375
Last seen 4.7 years ago
Brazil/Campinas/UNICAMP
> c2v2_safe<-list('12345_at'=strsplit(df[1,2], "\t")[[1]]) and it works. > > The question is how to replace 12345_at with the df[i, 1] variables. for this particular case: names(c2v2_safe) = df[1, 1] ? b
ADD COMMENT
0
Entering edit mode
Weiwei Shi ★ 1.2k
@weiwei-shi-1407
Last seen 10.2 years ago
try the following ( i haven't tested it) result = lapply(df[,2], function(x) x) names(result) <- df[,1] HTH, weiwei On 7/24/07, Li, Aiguo (NIH/NCI) [C] <liai at="" mail.nih.gov=""> wrote: > Hi all, > > > > I need to make a list as the following format: > > $`1555385_at` > > [1] "00604" "01031" > > > > $`224869_s_at` > > [1] NA > > > > $`210477_x_at` > > [1] "04010" "04310" "04510" "04620" "04664" "04910" "04912" "04920" > "04930" "05120" "05210" > > > > $`212807_s_at` > > [1] NA > > > > Now I have the following data frame. > > > df[1,1] > > [1] "1007_s_at" > > > > >df[1,2] > > [[1]] > > [1] "244" "501" "578" "579" "604" "611" "844" "877" "909" > "951" "954" "1181" "1305" "1312" > > > > How can I use a for loop to make a list object as the above format? > > > > I tried the following: > > c2v2_safe<-list('12345_at'=strsplit(df[1,2], "\t")[[1]]) and it works. > > > > The question is how to replace 12345_at with the df[i, 1] variables. > > > > Thanks, > > > > AG Lee > > > > > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III
ADD COMMENT

Login before adding your answer.

Traffic: 956 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6