Re: [R] Basic function output/scope question

2009-09-22 Thread David Young
Thanks Erik, Schalk, Patrick, and David for you helpful advice. I hope I'll, at some point, I'll become versed enough in R to return the favor. -- Best regards, David Young Marketing and Statistical Consultant Madrid, Spain +34 913 540 381 http://www.linkedin.com/in/europedavidyoung Monday,

Re: [R] Basic function output/scope question

2009-09-21 Thread Erik Iverson
son > Sent: Monday, September 21, 2009 10:43 AM > To: David Young; r-help@r-project.org > Subject: Re: [R] Basic function output/scope question > > Hello, > > > > > testfunc<-function(x) > > { y<-10 > > print(y) > > print(x) > > } > >

Re: [R] Basic function output/scope question

2009-09-21 Thread David Winsemius
On Sep 21, 2009, at 11:29 AM, David Young wrote: Hello Group, I'm trying to learn R and am having a problem getting output from a function I'm trying to write. The problem is clearly one of scope, but I can't find the documentation that tells me how to get around the issue. Here is an exampl

Re: [R] Basic function output/scope question

2009-09-21 Thread Erik Iverson
Hello, > > testfunc<-function(x) > { y<-10 > print(y) > print(x) > } > > testfunc(4) > > The variables x and y are accessible during execution of the function > "testfunc" but not afterwards. In R, expressions return values. When you define a function, ?function says that, "If the end of

Re: [R] Basic function output/scope question

2009-09-21 Thread Schalk Heunis
Don't know SAS, but you can use y<<-10 to make the answer available in the global environement. See ?'<<-' To define the output see ?return Schalk Heunis On Mon, Sep 21, 2009 at 5:29 PM, David Young wrote: > Hello Group, > > I'm trying to learn R and am having a problem getting output from a >

[R] Basic function output/scope question

2009-09-21 Thread David Young
Hello Group, I'm trying to learn R and am having a problem getting output from a function I'm trying to write. The problem is clearly one of scope, but I can't find the documentation that tells me how to get around the issue. Here is an example of my problem. testfunc<-function(x) { y<-10 print