> suppose I have a function example:
>
> getMatrix <- function(a,b){
>
> A1<-diag(1,2,2)
>
> }
>
> If I want to get the both the A1 and dim(A1) from the function, Can I do
>
> return(A1,dim(A1)) inside the function ? And how can I access A1 and
> dim(A1) later on?
The general approach for this is to use a list
getMatrix <- function(a,b){
A1<-diag(1,2,2)
list(diag=A1,dim=dim(A1))
}
foo <- getMatrix(something)
foo$diag
foo$dim
Cheers
Jason
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html