[R] Noob question re: writing while loops on one line
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Sun Feb 15 17:39:22 CET 2015
Best not to be pedantic, John, unless you are going to be right. Please read section 10.3.5 in the R Language Definition document. This is R, not C.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On February 15, 2015 8:20:39 AM PST, John McKown <john.archie.mckown at gmail.com> wrote:
>On Sun, Feb 15, 2015 at 9:54 AM, Duncan Murdoch
><murdoch.duncan at gmail.com>
>wrote:
>
>> On 15/02/2015 10:08 AM, Sun Shine wrote:
>> > Thanks John: understanding it as a line return makes sense!
>>
>> But it's not right. This is one statement, and it returns the value
>3:
>>
>> 1 +
>> 2
>>
>> This is an error:
>>
>> 1 + ; 2
>>
>> The semicolon is a statement separator, not a line return.
>>
>
>Technically speaking a semicolon is a statement terminator, not a
>statement separator. In the case of the R language, that is a "nit". In
>the
>case of Pascal, it is a big difference.
>
>
>>
>> Duncan Murdoch
>>
>>
>This is one reason why I _always_ use the semi-colon. It is _never_
>really
>wrong to do so. It may be _unnecessary_ in some case. It is also why I
>always use <- as the assignment operator (well, that and because I like
>it
>from my APL background). If there are two ways to express something,
>and
>one of them is _always_ correct whereas the other _might not_ be
>correct in
>some cases, then I think doing the former is simply "better form". But,
>then, I'm anal about other things to. And that doesn't apply to
>interactive
>use. I don't terminate my interactive statements with a semi-colon all
>the
>time. Just most of the time. Of course, I'm a touch typist too and so
>it is
>not really much of a problem for me.
>
>
>
>--
>He's about as useful as a wax frying pan.
>
>10 to the 12th power microphones = 1 Megaphone
>
>Maranatha! <><
>John McKown
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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