Re: [R] local and global variables

2014-06-21 Thread Bert Gunter
What you want here, of course, is pass by reference. It can be done in R (via environments), but in general, it violates the functional programming paradigm that mostly underlies R. So you should heed the advice given to you by Duncan and Jeff. Cheers, Bert Bert Gunter Genentech Nonclinical Bio

Re: [R] local and global variables

2014-06-21 Thread Jeff Newmiller
You are not following the Posting Guide. This is a plain text mailing list (HTML does not necessarily show us what you see). Also, you should be providing a reproducible example that we can run to understand what you are actually dealing with. The only general advice I can give you at this poin

Re: [R] local and global variables

2014-06-21 Thread Duncan Murdoch
On 22/06/2014, 6:00 AM, Ragia Ibrahim wrote: > Dear group > I have some thing like the following code... > ##start > my_list (global object) > > function 1 > { > list1<-mylist > > function2(list1) > function3(list1) > function4(list1) > } > > function2(list1) > { > assign values via <<- to the

[R] local and global variables

2014-06-21 Thread Ragia Ibrahim
Dear group I have some thing like the following code... ##start my_list (global object) function 1 { list1<-mylist function2(list1) function3(list1) function4(list1) } function2(list1) { assign values via <<- to the object items } function3(list1) { assign values via <<- to the object items }

Re: [R] local and global variables

2010-04-20 Thread Duncan Murdoch
On 20/04/2010 4:27 AM, n.via...@libero.it wrote: Hi all, I have a question about global and local variables.First of all, a variable defined in a for loop is it a local or global variable?? R doesn't create a local scope for "for" loops. So it will have the same scope as other variables c

[R] local and global variables

2010-04-20 Thread n.via...@libero.it
Hi all, I have a question about global and local variables.First of all, a variable defined in a for loop is it a local or global variable?? Second, I'm trying to build a loop in the following way: I have these 3 data frames bilanci_2005<-bilanci1[ANNO==2005,] bilanci_2006<-bilanci1[ANNO==2006,] b