[R] Constructing a matrix of outputs from loop

David Carlson dcarlson at tamu.edu
Mon Jul 8 23:06:44 CEST 2013


e.g. output <- outer(ap, am, func)

David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Edward Patzelt
Sent: Monday, July 8, 2013 3:15 PM
To: r-help at r-project.org
Subject: [R] Constructing a matrix of outputs from loop

R -

I would like to construct a matrix from the output of a loop that
has 2
values it varies over the course of the loop creating a 20x20 matrix
output values:

 ap = logspace(-3, 0, 20)

 am = logspace(-3, .7, 20)
  for (ap in apList)
   for (am in amList)

 output = func(ap, am)

i.e. cell 1x1 is -3,-3 and the value is 45 or something

*Edward H Patzelt | Research Assistant
Psychology | University of Minnesota  | Elliott Hall, 75 East River
Road |
Minneapolis, MN 55455
Email: patze003 at umn.edu  |
Main: 612.626.0072
Mobile: 651.315.3410
| Office: S355


	[[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list