Michael Rennie <mdrennie <at> gmail.com> writes:

> 
> 
> Hi gang,
> 
> I'm perplexed- I have some code that uses for() loops that works fine in 
> R version 2.8 on my mac, worked fine in version 2.8 on my old windows 
> machine, but doesn't work in version 2.10 on windows.
> 
> The loop implements a function over a data frame (code is included below).
> 
> In Mac (running version 2.8), the results of the loop are what I expect:
> 
>  > p_unadj
> [1] 0.034939481 0.015743706 0.089287030 0.001098538 0.039290594



Hi Michael,

I'm not sure what the mac is doing, but if you change the syntax of the loop as
follows it gives the same answers:

> for ( i in 1:length(lab8.dat[,1]) )
+          p_unadj[i]<-calc.prob.t(lab8.dat[i,2], lab8.dat[i,3])

> p_unadj 
[1] 0.034939481 0.015743706 0.089287030 0.001098538 0.039290594


Hope this helps,

Michael Bibo,
Queensland Health

______________________________________________
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.

Reply via email to