Thanks to all!!!
--
View this message in context:
http://r.789695.n4.nabble.com/Global-variables-tp4710473p4710483.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
http
normally that works,
BUT <<- is BAD and not accepted in some repositories as Bioconductor.
one<-function(){
a<-"variable passed"
return(a)
}
x <- one()
two<-function(x){
print(x)
}
On Tue, Jul 28, 2015 at 1:22 PM, jpara3
wrote:
> Hi, I want to pass a variable value from one function to anoth
Please don't. Function arguments are good... global variables are bad.
one <- function(){
result <- list( a="variable passed" )
result
}
two <- function( v ){
print( v$a )
}
x <- one()
two( x )
---
Jeff Newmiller
In line comments
On 28/07/2015 13:22, jpara3 wrote:
Hi, I want to pass a variable value from one function to another, but not as
a function argument. For this propose I have put <<-, but it doesn´t work.
My code:
one<-function(){
a<<-"variable passed"
}
So you have to execute one() first?
Hi, I want to pass a variable value from one function to another, but not as
a function argument. For this propose I have put <<-, but it doesn´t work.
My code:
one<-function(){
a<<-"variable passed"
}
two<-function(){
print(a)
}
dos()
If I execute dos(), then the error message is:
Error in p
On Fri, May 4, 2012 at 3:06 PM, Luis Goncalves wrote:
>
>
> On May 2 2011, 3:02 pm, Kenn Konstabel wrote:
>> On Mon, May 2, 2011 at 2:19 PM, abhagwat wrote:
>> > Well, what would be really helpful is to restrict the scope of all
>> > non-function variables, but keep a global for scope of all fun
On Mon, May 2, 2011 at 2:19 PM, abhagwat wrote:
> Well, what would be really helpful is to restrict the scope of all
> non-function variables, but keep a global for scope of all function
> variables. Then, you still have access to all loaded functions, but you
> don't mix up variables.
>
> How wou
On 02/05/2011 7:19 AM, abhagwat wrote:
Well, what would be really helpful is to restrict the scope of all
non-function variables, but keep a global for scope of all function
variables. Then, you still have access to all loaded functions, but you
don't mix up variables.
How would one do that?
Y
Well, what would be really helpful is to restrict the scope of all
non-function variables, but keep a global for scope of all function
variables. Then, you still have access to all loaded functions, but you
don't mix up variables.
How would one do that?
Adi
> Is there a way I can prevent global
Thanks,
I will have a look at it.
Sebastien
Michael Bedward wrote:
Hi Sebastian,
You might also find the proto package useful as a way of restricting
the scope of variables. It provides a more intuitive (at least to me)
way of packaging variables and functions up into environments that can
be
Hi Sebastian,
You might also find the proto package useful as a way of restricting
the scope of variables. It provides a more intuitive (at least to me)
way of packaging variables and functions up into environments that can
be related in a hierarchy.
Michael
On 10 January 2011 23:48, Sebastien B
Thank Gabor and Duncan,
That will be helpful.
Gabor Grothendieck wrote:
> On Thu, Jan 6, 2011 at 4:59 PM, Duncan Murdoch
> wrote:
>
>> On 06/01/2011 4:45 PM, Sebastien Bihorel wrote:
>>
>>> Dear R-users,
>>>
>>> Is there a way I can prevent global variables to be visible within my
>>> f
On Thu, Jan 6, 2011 at 4:59 PM, Duncan Murdoch wrote:
> On 06/01/2011 4:45 PM, Sebastien Bihorel wrote:
>>
>> Dear R-users,
>>
>> Is there a way I can prevent global variables to be visible within my
>> functions?
>
>
> Yes, but you probably shouldn't. You would do it by setting the environment
>
On 06/01/2011 4:45 PM, Sebastien Bihorel wrote:
Dear R-users,
Is there a way I can prevent global variables to be visible within my
functions?
Yes, but you probably shouldn't. You would do it by setting the
environment of the function to something that doesn't have the global
environment a
Dear R-users,
Is there a way I can prevent global variables to be visible within my
functions?
Sebastien
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/post
Hi Keith,
A more specific example of what you're looking for might be
helpful--ie do you want to read global variables or set them? You
probably want to look at environments and closures; ?"<<-" and ?assign
are good starting points (the latter has an example of "Global
Assignment within a function
I think you are looking for a macro facility. See defmacro in gtools
which is based on Thomas Lumley's function of the same name whose
article you can find in back issues of R News.
On Thu, Dec 10, 2009 at 11:00 AM, Keith Jones wrote:
> Y'all,
>
> I would like to have most of the variables in m
Y'all,
I would like to have most of the variables in my function to be global
instead of local. I have not found any references that tell me now to
do that. If I have missed a reference please excuse me and tell me
what I have missed.
Thanks,
Keith Jones
__
18 matches
Mail list logo