How to use new list output format in BehaviorSpace

I would like to use the new (in 6.4) list output format for BehaviorSpace. It seems just what I need to output a table of values for each patch at the end of a run. But the description is very brief, there is no code example, and just a screenshot of a spreadsheet example but no table version.

Here is what my colleague and I want to do. We want to have a table output for analysis in R that has the following for each patch:

globalvar 1, globalvar2, pxcor, pycor, patchvar1, patchvar2, patchvar3

We’ve created a reporter

to-report patchoutput
report [(list pxcor pycor patchvar1 patchvar2 patchvar3)] of patches
end

We put this in the output metrics. We specify globalvar1 and globalvar2 as the variables to vary in the experiment. We create table and list output files using the same base names. And we get an output with a line for each combination of globalvar1 and globalvar2, and columns for each of the 5 variables for each patch.

So far so good.

But the patch variable columns are just numbered from 1 to 500 (100 patches with 5 variables).

For analysis, we need each patch on its own line with the globals and patch variables. Is there a way to code this for that kind of result?

Alternatively, is there a way to get variable names for the patch columns instead of numbers? If we could do that, we could pivot the columns into lines in R.

Any other tips or code examples on using this new feature?

Perhaps you could try the following set of measures during the Behavior Space run:

With this, you will obtain the following output:

Here I have filtered the results with global1 = 50 and global2 = 50. The column headings are the patch numbers.

I think you may be able to extract necessary data from this table and then transpose the columns and rows.

Thanks. But this is the same issue I had with the table format. Even if I transpose this spreadsheeet output, I’m left with 3 columns for every patch that need to be then parsed into additional rows. We ended up just writing code to output a CSV. This list format could be useful, but needs more options.