[BioC] How to make a list as below

Weiwei Shi helprhelp at gmail.com
Wed Jul 25 00:06:22 CEST 2007


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



More information about the Bioconductor mailing list