[R] local and global variables
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Sun Jun 22 06:33:43 CEST 2014
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 point is that you should avoid using <<- at all. Instead, return results or lists of results from the functions and assign them to global variables where you call the functions.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On June 21, 2014 9:00:53 PM PDT, Ragia Ibrahim <ragia11 at hotmail.com> 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 object items
>}
>
>function3(list1)
>{
>assign values via <<- to the object items
>}
># end
>
>
>why after finishing each function the object variable is NULL..how can
>i keep its values across functions.
>
>Regardes
>RAE
>
> [[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.
More information about the R-help
mailing list