Re: [R] Lookups in R

2007-07-05 Thread Michael Frumin
the problem I have is that userid's are not just sequential from 1:n_users. if they were, of course I'd have made a big matrix that was n_users x n_fields and that would be that. but, I think what I cando is just use the hash to store the index into the result matrix, nothing more. then the rest

Re: [R] Lookups in R

2007-07-05 Thread jim holtman
You are getting two very different results in what you are comparing. system.time(lapply(1:10^4, mean)) user system elapsed 1.310.001.31 is returning a list with 10,000 values in it. It is taking time to allocate the space and such. system.time(for(i in 1:10^4) mean(i)) user

Re: [R] Lookups in R

2007-07-05 Thread deepayan . sarkar
On 7/5/07, jim holtman [EMAIL PROTECTED] wrote: You are getting two very different results in what you are comparing. system.time(lapply(1:10^4, mean)) user system elapsed 1.310.001.31 is returning a list with 10,000 values in it. It is taking time to allocate the space and

[R] Lookups in R

2007-07-04 Thread mfrumin
the CRAN package for SQLite hashes, but that seems to be going a bit too far. thanks, Mike Intern, Oyster Card Group, Transport for London (feel free to email back to this address, I'm posting through NAbble so I hope it works). -- View this message in context: http://www.nabble.com/Lookups-in-R

Re: [R] Lookups in R

2007-07-04 Thread Peter Dalgaard
mfrumin wrote: Hey all; I'm a beginner++ user of R, trying to use it to do some processing of data sets of over 1M rows, and running into a snafu. imagine that my input is a huge table of transactions, each linked to a specif user id. as I run through the transactions, I need to update a

Re: [R] Lookups in R

2007-07-04 Thread Martin Morgan
Michael, A hash provides constant-time access, though the resulting perl-esque data structures (a hash of lists, e.g.) are not convenient for other manipulations n_accts - 10^3 n_trans - 10^4 t - list() t$amt - runif(n_trans) t$acct - as.character(round(runif(n_trans, 1, n_accts))) uhash

Re: [R] Lookups in R

2007-07-04 Thread Michael Frumin
i wish it were that simple. unfortunately the logic i have to do on each transaction is substantially more complicated, and involves referencing the existing values of the user table through a number of conditions. any other thoughts on how to get better-than-linear performance time? is

Re: [R] Lookups in R

2007-07-04 Thread Michael Frumin
__ R-help@stat.math.ethz.ch 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.

Re: [R] Lookups in R

2007-07-04 Thread Peter Dalgaard
Michael Frumin wrote: i wish it were that simple. unfortunately the logic i have to do on each transaction is substantially more complicated, and involves referencing the existing values of the user table through a number of conditions. any other thoughts on how to get better-than-linear

Re: [R] Lookups in R

2007-07-04 Thread deepayan . sarkar
On 7/4/07, Martin Morgan [EMAIL PROTECTED] wrote: Michael, A hash provides constant-time access, though the resulting perl-esque data structures (a hash of lists, e.g.) are not convenient for other manipulations n_accts - 10^3 n_trans - 10^4 t - list() t$amt - runif(n_trans) t$acct