Re: [R] returning multiple values

2012-07-09 Thread arun
y, July 9, 2012 2:02 PM Subject: [R] returning multiple values I am running a program which has an output containing four vectors named meanfevs, meanfevns, pfevs, pfevns. I wish to return all four and be able to access them later. I used the command return(list(a=meanfevs,b=meanfevns,c=pfevs,

Re: [R] returning multiple values

2012-07-09 Thread Bert Gunter
Indeed. You do not understand lists. The behavior you expect is not how R works. Have you read "An Introduction to R" where this is explained (section 6.1). Also chapter 10 and 10.7 in particular for scoping in R. See also ?with ?within ?eval and e.g. ?lm or ?xyplot for the ubiquitous use of "dat

Re: [R] returning multiple values

2012-07-09 Thread R. Michael Weylandt
Hi, No, you won't be able to simply call "a" and have that work. R returns these in a single object with components (elements) named a,b,c,d Here's a concrete example: func <- function(x, y) return(list(a = x+1, b = y + 2)) out <- func(3, 5) out[["a"]] # or out$a out[["b"]] # or out$b give

[R] returning multiple values

2012-07-09 Thread PRAGYA SUR
I am running a program which has an output containing four vectors named meanfevs, meanfevns, pfevs, pfevns. I wish to return all four and be able to access them later. I used the command return(list(a=meanfevs,b=meanfevns,c=pfevs,d=pfevns)) it did give me the ouput. However the values did not get