Skip to content
Prev 350134 / 398506 Next

basic q re: parsing functions, declaration order

1. You should read a suitable R tutorial before proceeding. Is it not
advisable to learn a language's syntax before attempting to program in
it? An Intro to R ships with R, but there are many others available on
the Web. Choose that which suits. You may also wish to look at the R
Language manual; specifically your questions *may* have to do with
"lazy evaluation" in function calls (one aspect of which is: a default
argument in a function call is not evaluated until needed and can be
given a value in the body of a function that can depend on other
function arguments).

2. As Jeff intimated, you can use not -yet -defined functions in a
function definition (line # is a meaningless concept in R, though I
get your meaning). But the issue is: what is used when the function is
called.  This is all about scope, which in its full details is rather
complicated. But as Jeff intimated, in your situation, not worrying
about it may work fine.

Cheers,

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll




On Sat, Apr 18, 2015 at 12:40 PM, Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote: