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

Patrick Burns pburns at pburns.seanet.com
Fri Jan 30 11:12:15 CET 2009


'The R Inferno' page 36.


Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")

SnowManPaddington wrote:
> 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.
>>
>>
>>     
>
>




More information about the R-help mailing list