Re: [R] Function returning multiple objects but printing only one

2015-07-14 Thread Adams, Jean
Daniel, I'm not sure if this is what you're after, but you could include a print() call in your function. For example: myfun <- function(x) { m1 <- min(x) m2 <- mean(x) m3 <- max(x) out <- list(m1, m2, m3) print(out[[2]]) return(out) } result <- myfun(1:10) ​Jean ​ On Mon, Jul 13,

Re: [R] Function returning multiple objects but printing only one

2015-07-14 Thread Duncan Murdoch
On 13/07/2015 5:06 PM, Daniel Caro wrote: > Hello, > > Sorry if this has already been addressed before but I could not find any > helpful references. > > I would like to create a function that outputs a single element of a list > but stores all elements, similar to 'lm' and many other functions.

[R] Function returning multiple objects but printing only one

2015-07-13 Thread Daniel Caro
Hello, Sorry if this has already been addressed before but I could not find any helpful references. I would like to create a function that outputs a single element of a list but stores all elements, similar to 'lm' and many other functions. There are several answers on how to return multiple obj