[R] Creating a Hash from Data.Frame

Martin Morgan mtmorgan at fhcrc.org
Mon Jun 16 04:27:21 CEST 2008


"Gundala Viswanath" <gundalav at gmail.com> writes:

> Hi,
>
> I have the following data frame:
>
>> print(mydatframe)
>
> __DATAFRAME__
>
>    V1    V2 V3
> 1 1007_s_at  DDR1  discoidin domain receptor tyrosine kinase 1
> 2 1053_at  RFC2  replication factor C (activator 1) 2, 40kDa
> 3 117_at  HSPA6  heat shock 70kDa protein 6 (HSP70B')
>
> __END__
>
> Is there a way to create a hash with
> V2 as Key and V3 as its value?

This looks like microarray data for which the Bioconductor project
(http://bioconductor.org/biocLite.R) might be useful

> source('http://bioconductor.org/biocLite.R')
> biocLite() # installs a number of pacakges
> biocLite('hgu95av2.db') # a particular chip 'annotation' file
> library(hgu95av2.db)
> hgu95av2GENENAME[["1053_at"]]
[1] "replication factor C (activator 1) 2, 40kDa"
> hgu95av2SYMBOL[["1053_at"]]
[1] "RFC2"

probe id's are keys, with different 'hash'es underneath and
non-trivial functionality neatly encapsulated.

> openVignette()

and then choose AnnotationDbi for additional examples (or via the Bioc
web site, following the 'Packages' quick link). Also see the archives
and bioc mailing list, mentioned on the site.

Martin

> - Gundala Viswanath
> Jakarta - Indonesia
>
> ______________________________________________
> R-help at 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.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793



More information about the R-help mailing list