I have solved this problem once before but don't recall exactly how. Is there a url that shows how? What I want to do now is quite specific but my query is actually very general There are many functions in which one specifies several parameters and an output is generated. Well what happens if one wants to specify a range of parameters and have the output written to a data frame. To demonstrate: p1 <-15:25/100# so that I can vary the p1 from 0.15 to 0.25 for (i in p1) print(power.prop.test(p1=i,p2=0.5*i,power=0.8, sig.level=0.05)) That prints a whole flurry of pretty outputs but I actually want it to output into a data frame so that I can plot it? Farrel Buchinsky
Henrique Dallazuanna
2008-Oct-28 23:57 UTC
[R] outputting (writing) output into a dataframe
Try this: do.call(rbind.data.frame, lapply(p1, function(i)power.prop.test(p1=i,p2=0.5*i,power=0.8, sig.level=0.05))) On Tue, Oct 28, 2008 at 7:16 PM, Farrel Buchinsky <fjbuch@gmail.com> wrote:> I have solved this problem once before but don't recall exactly how. > Is there a url that shows how? > > What I want to do now is quite specific but my query is actually very > general > > There are many functions in which one specifies several parameters and > an output is generated. Well what happens if one wants to specify a > range of parameters and have the output written to a data frame. > > To demonstrate: > > p1 <-15:25/100# so that I can vary the p1 from 0.15 to 0.25 > > for (i in p1) print(power.prop.test(p1=i,p2=0.5*i,power=0.8, > sig.level=0.05)) > > That prints a whole flurry of pretty outputs but I actually want it to > output into a data frame so that I can plot it? > > Farrel Buchinsky > > ______________________________________________ > 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/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]