Re: [R] Replace values on seq

2007-10-23 Thread Walter Alini
> I will report results then, OK, its better this way, but no so much. Before: 99.79 (a) vs 0.21 (b) Now: 99.77 (a) vs 0.23 (b) But these results continue to be surprising for me. Ok. Thanks you guys again, I will continue bothering you sometime. Walter ___

Re: [R] Replace values on seq

2007-10-23 Thread Walter Alini
> Does this help clarify the differences? For sure! Thanks Jim. I will test with the solutions you gave me, maybe the differences are not so big, I was just surprised about that. I will report results then, Thanks! Walter __ R-help@r-project.org mail

Re: [R] Replace values on seq

2007-10-23 Thread jim holtman
Well you do know that R is 'interpreted' and that C is 'compiled'. In R you are calling functions to perform the operations. There is a function for indexing ('['): > get ("[") .Primitive("[") So your 'for' statement in R is interpreting the R code and calling some functions to perform the oper

Re: [R] Replace values on seq

2007-10-23 Thread Walter Alini
> code (C in this case). What exactly are you asking? You can alway > 'time' (sys.time) a set of statements to see which is better (just > make sure you execute them enough times to get reasonable readings -- > several seconds) I was wondering where to seach for the code of these different optio

Re: [R] Replace values on seq

2007-10-23 Thread jim holtman
Guilty of what? What are you trying to compare? Now all the approaches do get down to 'loops' being performed in the base level code (C in this case). What exactly are you asking? You can alway 'time' (sys.time) a set of statements to see which is better (just make sure you execute them enough

Re: [R] Replace values on seq

2007-10-23 Thread Walter Alini
> Hope this is helpful, Certainly! Thanks Dan and Jim! Now, I wonder where I can dig in to realize why this is better. Is C code for this function better than others? Is C guilty on this? Maybe I am too newbie. Thanks again, guys! Walter __ R-help@r

Re: [R] Replace values on seq

2007-10-23 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Walter Alini > Sent: Tuesday, October 23, 2007 1:18 PM > To: r-help@r-project.org > Subject: [R] Replace values on seq > > Hey guys, sorry for the inconvenience (this

Re: [R] Replace values on seq

2007-10-23 Thread jim holtman
Is this what you want to do? > table <- seq(255, 0, by=-1) > data <- c(1,8,34,100) > data <- table[data + 1] > data [1] 254 247 221 155 On 10/23/07, Walter Alini <[EMAIL PROTECTED]> wrote: > Hey guys, sorry for the inconvenience (this might be a hundred times > answered question), but I have bee

[R] Replace values on seq

2007-10-23 Thread Walter Alini
Hey guys, sorry for the inconvenience (this might be a hundred times answered question), but I have been searching a while and gave up about the following: I have the following, table and data: table <- seq(255, 0, by=-1) data <- c(1,8,...) <--- doesn't matter what's in here Which would be th