Re: [R] Data Frame as Hash Table

2010-05-30 Thread Don MacQueen
If you only need a single variable (in this case value), and just want to refer to it by the "key", there are other options. value <- rnorm(6) names(value) <- format(seq(0.5,3,0.5)) value['1.5'] But do watch out for numerical precision in the output of seq() if your vector of values

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Alan Lue
...@r-project.org wrote: >> >> Message: 40 >> Date: Sun, 30 May 2010 09:24:22 +0100 >> From: Patrick Burns >> To:r-help@r-project.org,alan....@gmail.com >> Subject: Re: [R] Data Frame as Hash Table >> Message-ID:<4c0220b6.7090...@pburns.seanet.com> >>

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Marshall Feldman
t.org,alan@gmail.com Subject: Re: [R] Data Frame as Hash Table Message-ID:<4c0220b6.7090...@pburns.seanet.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed You might want to investigate the 'data.table' package. On 30/05/2010 09:03, Alan Lue wrote: > I

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Patrick Burns
You might want to investigate the 'data.table' package. On 30/05/2010 09:03, Alan Lue wrote: I'm interested in using a data frame as if it were a hash table. For instance if I had the following, (d<- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) keyvalue 1 0.5 -1.118665122 2 1

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Barry Rowlingson
On Sun, May 30, 2010 at 9:03 AM, Alan Lue wrote: > I'm interested in using a data frame as if it were a hash table.  For > instance if I had the following, > >> (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) >  key        value > 1 0.5 -1.118665122 > 2 1.0  0.465122921 > 3 1.5 -0.52923921

[R] Data Frame as Hash Table

2010-05-30 Thread Alan Lue
I'm interested in using a data frame as if it were a hash table. For instance if I had the following, > (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) keyvalue 1 0.5 -1.118665122 2 1.0 0.465122921 3 1.5 -0.529239211 4 2.0 -0.147324638 5 2.5 -1.531503795 6 3.0 -0.002720434 The