[R] Function output difficulties
(Ted Harding)
Ted.Harding at manchester.ac.uk
Wed Dec 3 20:03:32 CET 2008
On 03-Dec-08 13:41:53, emj83 wrote:
> is there anyway for some parts of the function output to not be
> returned, even if the output has been used to calculate a further
> part of the function? i have tried invisible() to no avail.
>
> Thanks Emma
It's not clear what you mean by "some parts of the function output".
The function output is whatever you nominate it to be, and can
include any selection of whatever was computed within the function.
For example:
testfn <- function(x){
X <- x^2 ; Y <- cos(X) ; Z <- (X + Y)/(1 + x)
c(X,Z)
}
testfn(1.1)
# [1] 1.210000 0.744295
However, I suspect your case may be a bit more complicated than that!
If you were to post the function (or something like it), explaining
what you want it to return, and in what way it returns what you do
not want, it would be easier to help.
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 03-Dec-08 Time: 19:03:29
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list