[R] Multiple calls to a function

Greg Snow Greg.Snow at intermountainmail.org
Wed Oct 31 20:33:05 CET 2007


Since you do not change anything in your call to the function, you could
just use the replicate function instead of the for loop (I don't know
that it will speed things up much, but it is a bit more readable).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.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 Keith Jones
> Sent: Wednesday, October 31, 2007 1:04 PM
> To: r-help at r-project.org
> Subject: [R] Multiple calls to a function
> 
> Hi y'all,
> 
> I wrote two functions; 1) sparsely samples a point pattern 
> and calculates the Clark Evans R value and Z score, 2) calls 
> the first function multiple times using a for loop and 
> generates a histogram. 
> I would like to know if there is a more efficient way of 
> calling the first function other than using the for loop.  Any ideas?
> 
> cel<-data.frame("R"=0,"RZ"=0,"CV"=0,"PVAL"=0,"INT"=0)
> for(i in 1:N) cel[i,]<-cezhpts(dat,np,cv)
> 
> Thanks,
> 
> Keith Jones
> 
> ______________________________________________
> 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.
> 



More information about the R-help mailing list