[R] multiple return

Manuele Pesenti amicogodzilla at bruttocarattere.org
Fri Jun 22 12:37:37 CEST 2007


Dear User,
what's the correct way to obtain a multiple return from a function?

for example creating the simple function:

somma <- function (a, b) {
  c <- a+b
  return (a, b, c)
}

when I call it, it runs but returns the following output:

> somma(5, 7)
$a
[1] 5

$b
[1] 7

$c
[1] 12

Warning message:
return multi-argomento sono deprecati in: return(a, b, c) 

i.e. multi-return is deprecated...

thanks a lot
best regards
	Manuele

-- 
Manuele Pesenti
	manuele a inventati.org
	amicogodzilla a jabber.linux.it
	http://mpesenti.polito.it



More information about the R-help mailing list