Re: [R] python-like dictionary for R

2011-01-01 Thread Petr Savicky
On Fri, Dec 31, 2010 at 04:07:07PM -0800, Martin Morgan wrote: [...] > Better to use an environment (and live with reference semantics) > > e <- new.env(parent=emptyenv()); t0 <- Sys.time() > for (i in seq_len(1e6)) { > key <- as.character(i) > e[[key]] <- i > if (0 == i %% 1) >

Re: [R] python-like dictionary for R

2010-12-31 Thread Martin Morgan
On 12/30/2010 02:30 PM, Paul Rigor wrote: > Thanks gang, > I'll work with named vectors and concatenate as needed. This might be ok for small problems, but concatenation is an inefficient R pattern -- the objects being concatenated are copied in full, so becomes longer, and the concatenation slowe

Re: [R] python-like dictionary for R

2010-12-30 Thread Paul Rigor
Thanks gang, I'll work with named vectors and concatenate as needed. Paul On Thu, Dec 23, 2010 at 7:39 AM, Seth Falcon wrote: > On Wed, Dec 22, 2010 at 7:05 PM, Martin Morgan wrote: > > On 12/22/2010 05:49 PM, Paul Rigor wrote: > >> Hi, > >> > >> I was wondering if anyone has played around this

Re: [R] python-like dictionary for R

2010-12-23 Thread Seth Falcon
On Wed, Dec 22, 2010 at 7:05 PM, Martin Morgan wrote: > On 12/22/2010 05:49 PM, Paul Rigor wrote: >> Hi, >> >> I was wondering if anyone has played around this this package called >> "rdict"? It attempts to implement a hash table in R using skip lists. Just >> came across it while trying to look f

Re: [R] python-like dictionary for R

2010-12-22 Thread Martin Morgan
On 12/22/2010 05:49 PM, Paul Rigor wrote: > Hi, > > I was wondering if anyone has played around this this package called > "rdict"? It attempts to implement a hash table in R using skip lists. Just > came across it while trying to look for simpler text manipulation methods: > > http://userprimary

Re: [R] python-like dictionary for R

2010-12-22 Thread Phil Spector
Paul - You can also use named vectors as something similar to a python dictionary: nvec = c('one'=20,'two'=30,'three'=40) nvec['four'] = 50 nvec['one'] one 20 nvec['four'] four 50 Although the result is named, it can be used as a regular R value: 20 + nvec['three'] three 60 If t

[R] python-like dictionary for R

2010-12-22 Thread Paul Rigor
Hi, I was wondering if anyone has played around this this package called "rdict"? It attempts to implement a hash table in R using skip lists. Just came across it while trying to look for simpler text manipulation methods: http://userprimary.net/posts/2010/05/29/rdict-skip-list-hash-table-for-R/