Re: [R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-30 Thread Alan Lue
Is there a performance advantage to doing this, as opposed to growing the vector within the loop? I suppose R could have to dynamically reallocate memory at some point? Alan 2010/5/30 Uwe Ligges : > > > On 26.05.2010 08:52, Alan Lue wrote: >> >> Come to think of it, we can

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Alan Lue
; 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'm interested in using a data frame

[R] Data Frame as Hash Table

2010-05-30 Thread Alan Lue
0.002720434 Then I'd like to be able to quickly retrieve the "value" of "key" 1.5 to get -0.53. How would one go about doing this? Yours, Alan Lue __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] Counting indexes

2010-05-26 Thread Alan Lue
ng guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do rea

Re: [R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-25 Thread Alan Lue
Come to think of it, we can't save the output of each invocation and concatenate it later, since we need the output as input for the next iteration. Alan On Tue, May 25, 2010 at 11:43 PM, Alan Lue wrote: > Since `for' loops are slow in R, and since `apply' functions a

[R] Avoiding Loops When Iterating Over Statement That Updates Its Input

2010-05-25 Thread Alan Lue
Since `for' loops are slow in R, and since `apply' functions are faster, I was wondering whether there were a way to use an apply function—or to otherwise avoid using a loop—when iterating over a statement that updates its input. For example, here's some such code: r.seq <- 2 * (1 / d$Dt[1] - 1)

Re: [R] Determining Index of Last Element in Vector

2010-04-25 Thread Alan Lue
Those are great solutions. Thanks so much for your help. Yours, Alan On Sun, Apr 25, 2010 at 11:43 AM, David Winsemius wrote: > > On Apr 25, 2010, at 2:22 PM, Chuck Cleland wrote: > >> On 4/25/2010 2:10 PM, Alan Lue wrote: >>> >>> Hi, >>> >>&

Re: [R] Determining Index of Last Element in Vector

2010-04-25 Thread Alan Lue
Sorry -- I meant `v(end)' and `v[length(v)]' in the first examples of my message. Alan On Sun, Apr 25, 2010 at 11:10 AM, Alan Lue wrote: > Hi, > Is there a way to specify the last element of a vector, similar to "end" in > MATLAB? >   v[end] > would be

[R] Determining Index of Last Element in Vector

2010-04-25 Thread Alan Lue
r the first and last? (I know you can achieve this using two lines, but I'm writing because I want to do it using one.) Alan -- Alan Lue Master of Financial Engineering UCLA Anderson School of Management [[alternative HTML version deleted]] _

[R] Math Expression in 3D Plots

2008-11-20 Thread Alan Lue
Is there anyway to label axes in 3D plots with mathematical expressions? In the code below, I want to replace "delta_yrsed" with what "\Delta \widehat{yrsed}" represents in TeX, but the [xyz]lab parameters of title3d appear to only accept character strings. require("rgl") fn.delta.yrsed <- funct

Re: [R] Updating Packages with Personal Library

2008-11-07 Thread Alan Lue
Test. On Fri, Nov 7, 2008 at 2:40 AM, Alan Lue <[EMAIL PROTECTED]> wrote: > I'm having trouble running `updates.packages()' and installing into a > personal library. > > Setup: > 1. .Renviron file contains: R_LIBS_USER="~/lib/R/%p-library/%v" > 2.

[R] Updating Packages with Personal Library

2008-11-07 Thread Alan Lue
I'm having trouble running `updates.packages()' and installing into a personal library. Setup: 1. .Renviron file contains: R_LIBS_USER="~/lib/R/%p-library/%v" 2. Hence "personal library" is: ~/lib/R/i486-pc-linux-gnu-library/2.6/ 3. Library path upon starting R: > .libPaths() [1] "/home/johnny/li