更新时间:2021-10-31 21:44:22
尽管rhdf5
软件包不在CRAN中,但它确实可以很好地工作.从生物导体
The rhdf5
package works really well, although it is not in CRAN. Install it from Bioconductor
# as of 2020-09-08, these are the updated instructions per
# https://bioconductor.org/install/
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.11")
并使用它:
library(rhdf5)
列出文件中的对象以查找要读取的数据组:
List the objects within the file to find the data group you want to read:
h5ls("path/to/file.h5")
读取HDF5数据:
mydata <- h5read("path/to/file.h5", "/mygroup/mydata")
检查结构:
str(mydata)
(请注意,多维数组可能会转置).您还可以阅读组,这些组将在R中命名为列表.
(Note that multidimensional arrays may appear transposed). Also you can read groups, which will be named lists in R.