[R] hash - extract key values

Boris Steipe
2015-03-28T01:54:40Z

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.