Created
June 13, 2018 20:00
-
-
Save kieranrcampbell/d25ac5c8758562b50f10eb5af9bba213 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Source an HDF5 file (ignoring all groups) where each | |
#' entry in the HDF5 is read and assigned to a variable | |
#' in the current environment | |
#' @importFrom rhdf5 h5ls | |
source_hdf5 <- function(filename, e) { | |
ls <- h5ls(filename) | |
vars <- ls$name | |
for(var in vars) { | |
assign(var, h5read(filename, var), envir = e) | |
} | |
} | |
# example usage | |
source_hdf5("myfile.h5", environment()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment