If you want to have a gui that allows you to change parameter values using
buttons/sliders/etc. and see what the effects are, then look at the tkexamp
function in the TeachingDemos package (see the examples on the help page).
If you have a predetermined set of values for the parameter of interest and want
to run the function multiple times with those values (and other set values),
then try mapply. Here is an example using the power.t.test function to find the
power for different sample sizes (and a fixed delta of 0.3, everything else at
its default):
> tmp <- mapply(power.t.test, n=c(10,20,30,50), MoreArgs=list(delta=0.3))
> unlist(tmp['power',])
[1] 0.09271619 0.15031255 0.20689369 0.31751712
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Inchallah Yarab
> Sent: Tuesday, July 28, 2009 3:36 AM
> To: r-help at r-project.org
> Subject: [R] vary the parameters for a function
>
>
>
>
>
>
>
> How I can vary the parameters for a function?
>
> I have a function with 5 parameters I want to turn the function for a
> range of numbers for one of these parameters!! i want to have in the
> end the value of the function in the different cas of one of the
> paramter (the others paramters are fixes!!) thank you for your help
>
>
>
>
> [[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.