An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091113/cd72c974/attachment-0001.pl>
R and HDF5 Question
4 messages · Scott MacDonald, Berwin A Turlach, Paul Hiemstra
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
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091113/ba881ca1/attachment-0001.pl>
Hi, You can also read the hdf5 files with the rgdal package. This loads them into sp-objects, see the sp-package for more info. In the archives of the r-sig-geo mailing list there have been some other people (including myself :)) that have asked this question: https://stat.ethz.ch/pipermail/r-sig-geo/2009-January/004828.html http://markmail.org/message/ypsr77vl3qscq72f#query:r-sig-geo%20read%20hdf5+page:1+mid:ivkt5qxroeh3z646+state:results http://www.mail-archive.com/r-sig-geo at stat.math.ethz.ch/msg01871.html cheers, Paul
Scott MacDonald wrote:
That did it, boy do I feel silly. Thanks! On Fri, Nov 13, 2009 at 10:16 PM, Berwin A Turlach <berwin at maths.uwa.edu.au>wrote:
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
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul