Hi everyone, I have a question about functions. I have two functions: Sampling=function(fname,Total,nSample,nPatient){......return(list(Gmean,Gsd))} Power=function(alfa,m1,m2,s1,s2,n1,n2){....return(powe)} I want to use "Gmean" and "Gsd" which are the returned values from "Sampling" function, in "Power" function. i.e. when I call "power" I want to be able to have something like: Power(.05,Mmean,Gmean,Msd,Gsd,992,100) Ps: Mmean and Gmean are the same size. Msd and Gsd are the size. Thanks -- View this message in context: http://www.nabble.com/Fuctions-help%21-tp20130620p20130620.html Sent from the R help mailing list archive at Nabble.com.
On Thu, Oct 23, 2008 at 9:10 AM, Alex99 <loyola9988 at yahoo.com> wrote:> > Hi everyone, > > I have a question about functions. I have two functions: > > Sampling=function(fname,Total,nSample,nPatient){......return(list(Gmean,Gsd))} > > Power=function(alfa,m1,m2,s1,s2,n1,n2){....return(powe)} > > I want to use "Gmean" and "Gsd" which are the returned values from > "Sampling" function, in "Power" function. > i.e. when I call "power" I want to be able to have something like: > > Power(.05,Mmean,Gmean,Msd,Gsd,992,100)Okay, so do that. Or, you could follow the posting guide, clearly state your question, and give us a working example, or one as close to working as you can get. Frankly, I haven't the foggiest idea what you want to do, or what you are asking. Sarah -- Sarah Goslee http://www.functionaldiversity.org
what are you trying to do? Break the problem down make it reproducible and then maybe we can help. stephen On Thu, Oct 23, 2008 at 9:10 AM, Alex99 <loyola9988 at yahoo.com> wrote:> > Hi everyone, > > I have a question about functions. I have two functions: > > Sampling=function(fname,Total,nSample,nPatient){......return(list(Gmean,Gsd))} > > Power=function(alfa,m1,m2,s1,s2,n1,n2){....return(powe)} > > I want to use "Gmean" and "Gsd" which are the returned values from > "Sampling" function, in "Power" function. > i.e. when I call "power" I want to be able to have something like: > > Power(.05,Mmean,Gmean,Msd,Gsd,992,100) > > Ps: Mmean and Gmean are the same size. Msd and Gsd are the size. > > Thanks > > -- > View this message in context: http://www.nabble.com/Fuctions-help%21-tp20130620p20130620.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
See ?with also ?do.call Use of the latter will need to have the names of the returned value match those of formals( Power ) HTH, Chuck On Thu, 23 Oct 2008, Alex99 wrote:> > Hi everyone, > > I have a question about functions. I have two functions: > > Sampling=function(fname,Total,nSample,nPatient){......return(list(Gmean,Gsd))} > > Power=function(alfa,m1,m2,s1,s2,n1,n2){....return(powe)} > > I want to use "Gmean" and "Gsd" which are the returned values from > "Sampling" function, in "Power" function. > i.e. when I call "power" I want to be able to have something like: > > Power(.05,Mmean,Gmean,Msd,Gsd,992,100) > > Ps: Mmean and Gmean are the same size. Msd and Gsd are the size. > > Thanks > > -- > View this message in context: http://www.nabble.com/Fuctions-help%21-tp20130620p20130620.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901