[R] Re use objects from within a custom made function

Stropharia stevenworthington at hotmail.com
Tue Oct 13 01:06:43 CEST 2009

Hi everyone,

i'm having a problem extracting objects out of functions i've created, so i
can use them for further analysis. Here's a small example:

# ---------------------------
test <- function(i, j){
	x <- i:j
	y <- i*j
	z <- i/j
# ---------------------------

This returns the 3 objects as $x, $y and $z. I cannot, however, access these
objects individually by typing for example:


I know i can do this by adding an extra arrow head to the assignment arrow
(<<-), but I am sure that is not how it is done in some of the established R
functions (like when calling lm$coef out of the lm function). Is there a
simple command i've omitted from the function that allows access to objects
inside it?

Thanks in advance,

View this message in context: http://www.nabble.com/Reuse-objects-from-within-a-custom-made-function-tp25864695p25864695.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list