Inspects an HDF5 object (or an attribute attached to it) and returns the R class
that h5_read() would produce.
Value
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.
Details
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"
Examples
file <- tempfile(fileext = ".h5")
h5_write(1:10, file, "my_ints", as = "int32")
h5_class(file, "my_ints") # "numeric"
#> [1] "numeric"
h5_write(mtcars, file, "mtcars")
h5_class(file, "mtcars") # "data.frame"
#> [1] "data.frame"
h5_write(c("a", "b", "c"), file, "strings")
h5_class(file, "strings") # "character"
#> [1] "character"
h5_write(c(1, 2, 3), file, "my_floats", as = "float64")
h5_class(file, "my_floats") # "numeric"
#> [1] "numeric"
unlink(file)
