[R] R and HDF5 Question

Berwin A Turlach berwin at maths.uwa.edu.au
Sat Nov 14 06:16:20 CET 2009


G'day Scott,

On Fri, 13 Nov 2009 09:52:43 -0700
Scott MacDonald <scott.p.macdonald at gmail.com> wrote:

> I am trying to load an hdf5 file into R and running into some
> problems. 

It's a while that I used hdf5 files and that package in R, but:

> This builds fine. The library seems to load without issue, but no
> data is returned when I try to load a file:
> 
>     > library(hdf5)
>     > hdf5load("test.h5")
>     > NULL

Is NULL the return of the hdf5load command or are you typing it on the
command line?

Anyway, .hdf5 files can contain several objects, just as R's .rda
file.  load() will load an .rda file and put all objects in that file
into the workspace.  Likewise, hdf5load() loads an hdf5 file and puts
all objects in that file into the workspace. 

> Yet,
> 
>     osx:data scott$ h5dump test.h5 HDF5 "test.h5" { GROUP
> "/" { DATASET "dset" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE
> { ( 31 ) / ( 31 ) } DATA { (0): 1, 2, 4, 8, 16, 32, 64, 128, 256,
> 512, 1024, 2048, 4096, 8192, (14): 16384, 32768, 65536, 131072,
> 262144, 524288, 1048576, 2097152, (22): 4194304, 8388608, 16777216,
> 33554432, 67108864, 134217728, (28): 268435456, 536870912,
> 1073741824 } } } }
> 
> Any thoughts?

Did you try an ls() after the hdf5load() command?  If the hdf5load()
command was successfull, an ls() should show you that an object with
name "dset" is now in your workspace; if I read the output above
correctly.

HTH.

Cheers,
	
	Berwin




More information about the R-help mailing list