[R] wierd expression
Thomas Lumley
tlumley at u.washington.edu
Fri Mar 29 02:12:49 CET 2002
On Thu, 28 Mar 2002, Francisco J Molina wrote:
> I apologize a priori if this is too basic.
>
> For my defense, I claim and assert I am reading the manuals.
>
> I have found this expression
>
> ab = double(length(a) + length(b) - 1))$ab
>
> in "writing R extensions".
>
> ab is supposed to be a vector ( it is not a list ).
>
> What does the last expression do?
Actually, you found the expression
.C("convolve",
as.double(a),
as.integer(length(a)),
as.double(b),
as.integer(length(b)),
ab = double(length(a) + length(b) - 1))$ab
and quoted the last line of it.
The expression calls a C function and passes 5 arguments to it. It
receives back a list of the new values of those 5 arguments and extracts
the $ab component of the list.
-thomas
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list