Re: [R] Vectorizing loop

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Mon 10 Oct 2005 - 23:00:45 EST


Not unless we know what runifpoint() and Kest() are. AFAIK these are not part of base R. If you use functions from add-on packages, please state them so as not to leave others guessing. (This is in the Posting Guide, which you were asked to read.)

Andy

> From: Rainer M. Krug
>
> Hi
>
> I have the following loop and would like to vectorize it. Any
> ideas if
> it is possible?
>
> Thanks,
>
> Rainer
>
> Tha Loop:
>
> for (i in 2:Result$NoSims)
> {
> ppp <- runifpoint(Result$NoPlants)
> K <- Kest(ppp)
> Result$LSim[i,] <- sqrt(K$iso / pi) - K$r
> CM <- (Result$LSim[i,] * Result$LSim[i,]) / abs(K$r[2] - K$r[1])
> Result$SigCM[i] <- sum(CM, na.rm=TRUE)
> print(i)
> flush.console()
> }
>
>
>
>
>
>
>
>
> --
> NEW TELEPHONE NUMBER
> Tel: +27 - (0)72 808 2975 (w)
>
> Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
> Biology (UCT)
>
> Department of Conservation Ecology
> University of Stellenbosch
> Matieland 7602
> South Africa
>
> Tel: +27 - (0)72 808 2975 (w)
> Fax: +27 - (0)21 808 3304
> Cell: +27 - (0)83 9479 042
>
> email: RKrug@sun.ac.za
> Rainer@krugs.de
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Oct 10 23:17:45 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:41 EST