| h5_class | R Documentation |
Inspects an HDF5 object (or an attribute attached to it) and returns the R class
that h5_read() would produce.
h5_class(file, name, attr = NULL)
file |
The path to the HDF5 file. |
name |
The full path of the object (group or dataset) to check. |
attr |
The name of an attribute to check. If |
This function determines the resulting R class by inspecting the storage metadata.
Group \rightarrow "list"
Integer \rightarrow "numeric"
Floating Point \rightarrow "numeric"
String \rightarrow "character"
Complex \rightarrow "complex"
Enum \rightarrow "factor"
Opaque \rightarrow "raw"
Compound \rightarrow "data.frame"
Null \rightarrow "NULL"
A character string representing the R class (e.g., "integer", "numeric",
"complex", "character", "factor", "raw", "list", "NULL").
Returns NA_character_ for HDF5 types that h5lite cannot read.
h5_typeof(), h5_read()
file <- tempfile(fileext = ".h5")
h5_write(1:10, file, "my_ints", as = "int32")
h5_class(file, "my_ints") # "numeric"
h5_write(mtcars, file, "mtcars")
h5_class(file, "mtcars") # "data.frame"
h5_write(c("a", "b", "c"), file, "strings")
h5_class(file, "strings") # "character"
h5_write(c(1, 2, 3), file, "my_floats", as = "float64")
h5_class(file, "my_floats") # "numeric"
unlink(file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.