file <- tempfile(fileext = ".h5")
h5_write(1:100, file, "my_vec")
h5_length(file, "my_vec") # 100
h5_write(mtcars, file, "my_df")
h5_length(file, "my_df") # 11 (ncol(mtcars))
h5_write(as.matrix(mtcars), file, "my_mtx")
h5_length(file, "my_mtx") # 352 (prod(dim(mtcars)))
h5_length(file, "/") # 3
unlink(file)
Run the code above in your browser using DataLab