Re: [R] assignment by value or reference

From: Xiaobo Gu <guxiaobo1982_at_gmail.com>
Date: Tue, 08 Mar 2011 21:24:20 +0800

On Wed, Sep 15, 2010 at 5:05 PM, Uwe Ligges <ligges_at_statistik.tu-dortmund.de> wrote:
> See the R Language Definition manual. Since R knows about lazy evaluation,
> it is sometimes neither by reference nor by value.
> If you want to think binary, then "by value" fits better than "by
> reference".
Hi,
Can we think it's eventually by value?

For simple functions such as:
is(df[[1]], "logical")
used to test wheather the first column of data frame df is of type logical, will a new vector be created and used inside the is function?

Another example,

dbWriteTable(con, "tablename", df) will write the content of data frame df into a database table, will a new data frame object created and used inside the dbWriteTable function?

Thanks.

>
> Uwe Ligges
>
>
>
> On 05.09.2010 17:19, Xiaobo Gu wrote:
>>
>> Hi Team,
>>
>>          Can you please tell me the rules of assignment in R, by value or
>> by reference.
>>
>>> From my about 3 months of experience of part time job of R, it seems most
>>> times it is by value, especially in function parameter and return values
>>> assignment; and it is by reference when referencing container sub-objects of
>>> container objects, such as elements of List objects and row/column objects
>>> of DataFrame objectes; but it is by value when referencing the smallest unit
>>> of element of a container object, such as cell of data frame objects.
>>
>>
>>
>>
>>
>> Xiaobo.Gu
>>
>>
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help_at_r-project.org 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.
>



R-help_at_r-project.org 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. Received on Tue 08 Mar 2011 - 14:02:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Mar 2011 - 16:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive