R:使用rdhf5软件包从R读取.h5文件时出错

时间:2017-06-22 09:09:04

标签: r rhdf5

我是hdf5文件的新手。尝试从以下URL读取一些示例文件.. https://support.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/

尝试在R环境中读取其中一个.h5文件时

library(rhdf5) h5ls("h5ex_d_sofloat.h5")

我收到以下错误

  

H5Fopen出错(文件," H5F_ACC_RDONLY"):     HDF5。文件可访问性。无法打开文件。

帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

Windows本身存在一些问题,即在使用默认参数下载时加密hdf5文件。下载时只需将模式更改为" wb" ..

file_url <- "http://support.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/h5ex_d_sofloat.h5"
library(rhdf5)
download.file(url = file_url,destfile = "h5ex_d_sofloat.binary.h5",mode = "wb")
h5ls("h5ex_d_sofloat.binary.h5")


>   group name       otype dclass     dim
0     /  DS1 H5I_DATASET  FLOAT 64 x 32

我从生物医院本身得到了这个解决方案...... https://support.bioconductor.org/p/97311/#97362