[H5r-commits] r52 - R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 30 20:32:44 CEST 2011
Author: extemporaneousb
Date: 2011-06-30 20:32:43 +0200 (Thu, 30 Jun 2011)
New Revision: 52
Modified:
R/h5R.R
Log:
Added 'ls' method.
Modified: R/h5R.R
===================================================================
--- R/h5R.R 2011-05-05 16:39:29 UTC (rev 51)
+++ R/h5R.R 2011-06-30 18:32:43 UTC (rev 52)
@@ -572,7 +572,6 @@
## construct a list of elements in the file.
.listH5Contents <- function(h5Obj) .myCall("h5R_list_contents", .ePtr(h5Obj))
-
listH5Attributes <- function(h5Obj) .myCall("h5R_list_attributes", .ePtr(h5Obj))
listH5Contents <- function(h5Obj) {
@@ -600,6 +599,10 @@
return(lst)
}
+setMethod("ls", "H5Obj", function(name) {
+ names(listH5Contents(name))
+})
+
h5ObjectExists <- function(h5Obj, name) {
.myCall("h5R_dataset_exists", .ePtr(h5Obj), name)
}
@@ -750,6 +753,18 @@
return(d)
})
+writeH5DataFrame <- function(df, fileName, overwrite = T) {
+ if (file.exists(fileName) && overwrite) {
+ file.remove(fileName)
+ } else if (file.exists(fileName) && !overwrite) {
+ stop("File exists!")
+ }
+ h <- H5File(fileName, 'w')
+ mapply(df, colnames(df), FUN = function(a, nm) {
+ createH5Dataset(h, nm, a)
+ })
+ H5DataFrame(fileName)
+}
##
## hSlab stuff.
More information about the H5r-commits
mailing list