2
The basic structure of a function in R is:
function( arglist ) expr
return(value)
My question is how to return multiple information. For example:
funcao<-function(a,b,c){
if(c==1){d<-a+b}
else{d<-a-b}
return(d)
}
I want to know how I can add more information in Return.
So would have:
exemplo<-funcao(1,2,1)
>exemplo
3
>exemplo$metodo
"soma"