[R] scoping rules for 'for' [was - Re: for/if loop ]

SnowManPaddington wiwiana at gmail.com
Thu Jan 29 22:45:48 CET 2009


Hi ya, thanks a lot everyone!! I changed rr:ii-1 to rr:(ii-1) and the code
works!!! I finally get some estimates from the optimization function (i am
doing a logit model with 2 segments). Thanks thanks!!!
I didn't realize rr:(ii-1) and rr:ii-1 would make such a big difference,
especially because the professor used rr:ii-1 in his Gauss code. I didn't
realize it means so much different in R!



davidr-2 wrote:
> 
> The lines below made me understand clearly. Maybe they are already in
> some documentation,
> but if not, it might help others to avoid my misunderstanding.
> Thanks to all for the clarifications.
> -- David
> 
> 
> -----Original Message-----
> From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca] 
> Sent: Thursday, January 29, 2009 9:54 AM
> To: David Reiner <davidr at rhotrading.com>
> Cc: Henrik Bengtsson; r-help at r-project.org; SnowManPaddington
> Subject: [SPAM] - Re: [R] scoping rules for 'for' [was - Re: for/if loop
> ] - Found word(s) list error in the Text body
> 
> <snip>
>   Feel free to do what you like to the variable within the 
> loop (though you might cause Luke to grind his teeth when it messes up 
> his compiler).  It will be set to the next value in the 1:10 vector the 
> next time it comes back to the top.
> 
> <snip>
> 
> Duncan Murdoch
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/for-if-loop-tp21701496p21736578.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list