On 12/6/05, Judy Chung <cp3942 at gmail.com>
wrote:> Hi All,
> I have several lines of commands, and beacuse I will use these many
> times, so I collected
> these commands together using a function to describe it. like the
following:
> my.fun<-function(){
> .........
> entertitle()
> xaxis<-A
> yaxis<-B
> plot(....,xlab=xaxis,ylab=yaxis)
> .......
> }
>
> entertitle<-function() {
> cat("enter the name of A\n")
> A<-readline()
> cat("enter the name of B\n")
> B<-readline()
> return(A,B)
> }
> I hope the A and B generate form function " entertitle " can
return to
> my.fun, and
> do the following processing. Am I missing something? Any help as to
> where to start would be welcome. Thanks in advanced !!
Replace the return with:
return(list(A = A, B = B))
and then change the body of my.fun to:
with(entertitle(), {
... rest of function body goes here ...
}