[R] help regarding functions & loops

Sean O'Riordain sean.oriordain at gmail.com
Sun Aug 7 02:07:08 CEST 2005


Hi Rangesh,

Perhaps I mis-understand your question, but it could be as simple as...

p <- 1-exp(-exp(s))

In R, this is vectorized such that a new vector is calculated - one
value for each value of s, so p will have the same length as s.

In the "Introduction to R" read up on vectors and how to avoid loops.

cheers!
Sean

On 06/08/05, Rangesh Kunnavakkam <rangeshk at gmail.com> wrote:
> I am new to R,so excuse me if its too basic. I have a vector of scores
>         S= {s1,s2,s3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,sn}
> n could be very large.
> I want to find p-value for each score and I have the formula
>          pvalue= 1-exp(-exp(S))
> so any ideas how to get this new vector P={p1,p2,p3,p4,p5....pn}
> thankyou in advance
> Rangesh
> 
> ______________________________________________
> R-help at 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
>




More information about the R-help mailing list