swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using HDF5 to create an R data frame


From: Benedikt Stefansson
Subject: Re: Using HDF5 to create an R data frame
Date: Wed, 29 Mar 2000 14:36:23 -0700

"M. Lang & S. Railsback" wrote:

> I want to save the instance variable values from all the objects on a
> list in my Swarm model, and import them into R as a data frame. I
> understand that the way to do this is by using the Swarm archiver to
> write an HDF5 file, then opening this file in R.

> Does somebody have example code for both the Swarm and R ends?

Marcus gave some sample code for both Swarm and R ends (for arrays) in
http://www.santafe.edu/projects/swarm/archive/list-archive.9909/0085.html.
Dumping data for other collection types is simple, the example also
extends to reading collections such as lists into R.


> Where is the documentation for reading HDF5 in R?

Basic HDF5 read/write commands are explained in the documentation that is
included with R (the author of the module being no other than our very
own address@hidden).

The harder issue is how to do statistics over lists of objects with
instance variables. I have not been able to do that successfully. Problem
is to make statistical methods act on instance variables of objects
instead of more common array/matrix/dataframe. Although there is some
reflection in the R object language, it is quite cumbersome to do
something like 'give me summary statistics for the unhappiness of all
heatbugs' etc. Basically have to extract the values first into a 1xN
array on the R side, which then makes it almost worthwhile to export the
values from Swarm as an 1xN array in the first place (thus rendering the
whole object oriented spiel moot).

Benedikt

--
Benedikt Stefansson      | address@hidden
CASA, Inc.               | Ph : (505) 988-8807 x101
Santa Fe, NM 87501       | Fax: (505) 988-3440




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]