[R] hash - extract key values

Brian Smith bsmith030465 at gmail.com
Sat Mar 28 07:03:09 CET 2015


Exactly. Used to work for me, but not anymore. I tried restarting session,
installing the most recent package of 'hash' etc.

Here is my sessionInfo():

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
 [1] grid      parallel  stats4    stats     graphics  grDevices utils
datasets  methods   base

other attached packages:
 [1] mapdata_2.2-3        maps_2.3-9           org.Hs.eg.db_3.0.0
multicore_0.1-7      nlme_3.1-120         Rgraphviz_2.10.0
 [7] biomaRt_2.22.0       topGO_2.18.0         SparseM_1.6
 GO.db_3.0.0          graph_1.44.1         mouse4302.db_3.0.0
[13] org.Mm.eg.db_3.0.0   RSQLite_1.0.0        DBI_0.3.1
 AnnotationDbi_1.28.1 GenomeInfoDb_1.2.4   IRanges_2.0.1
[19] S4Vectors_0.4.0      Biobase_2.26.0       BiocGenerics_0.12.1
 XML_3.98-1.1         gap_1.1-12           som_0.3-5
[25] pvclust_1.3-2        foreign_0.8-63       hash_3.0.1

loaded via a namespace (and not attached):
[1] bitops_1.0-6    lattice_0.20-29 RCurl_1.95-4.5  tools_3.1.2




On Fri, Mar 27, 2015 at 9:54 PM, Boris Steipe <boris.steipe at utoronto.ca>
wrote:

> Works for me :
>
> > library(hash)
> hash-2.2.6 provided by Decision Patterns
>
> > hx <- hash( c('a','b','c'), 1:3 )
> > class(hx)
> [1] "hash"
> attr(,"package")
> [1] "hash"
> > hx$a
> [1] 1
> > keys(hx)
> [1] "a" "b" "c"
>
>
> Maybe restart your session? Clear your workspace? Upgrade?
>
> B.
>
>
>
>
>
> On Mar 27, 2015, at 7:39 PM, Brian Smith <bsmith030465 at gmail.com> wrote:
>
> > Hi,
> >
> > I was trying to use hash, but can't seem to get the keys from the hash.
> > According to the hash documentation ('hash' package pdf, the following
> > should work:
> >
> >> hx <- hash( c('a','b','c'), 1:3 )
> >> class(hx)
> > [1] "hash"
> > attr(,"package")
> > [1] "hash"
> >> hx$a
> > [1] 1
> >> keys(hx)
> > Error in (function (classes, fdef, mtable)  :
> >  unable to find an inherited method for function ‘keys’ for signature
> > ‘"hash"’
> >
> > How can I get the keys for my hash?
> >
> > thanks!
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list