Skip to content
Back to formatted view

Raw Message

Message-ID: <4952A8DF.6030503@idi.ntnu.no>
Date: 2008-12-24T21:25:51Z
From: Wacek Kusnierczyk
Subject: filling values in a vector using smaller vector
In-Reply-To: <200812240802.37991.mph@emotrics.com>

Milton Huang wrote:
> Thank you both for such beautiful solutions.  Just what I was looking for!  I 
> love the Internet, R, and the R-list!  There is so much opportunity to learn.  
> In fact, looking at the replace function, I see the two solutions are the 
> same:
>
>   
>> replace
>>     
> function (x, list, values)
> {
>     x[list] <- values
>     x
> }
> <environment: namespace:base>
>
>   

not exactly.  an application of replace generates a local copy of the
data, and whatever you pass to replace as x will not be modified, while
if you do the assignment yourself, you'll modify the data.


> Thanks again.  You made my day.  Have a happy holiday season.
>   

you too!  meRRy chRistmas and a happy new yeaR to all subscRibeRs.

vQ