Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple outputs from nested loops

Status
Not open for further replies.

lmenich

Structural
Joined
Apr 29, 2008
Messages
14
Location
CA
I have a relatively long programming function containing nested loops and am trying to retrieve more than one output from them. Is there a way I can assign a value within a function as a global variable? Or return more than one output using some other method?

Thanks
 
The output of a program can be a matrix. 'Augment' and 'stack' are two commands to get familiar with. For instance, to return multiple vectors from a program you can use the augment command to create one matrix.

output <- augment(vector1, vector2...)

Peter
 
Thanks! That was exactly what I needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top