无法将HDF5打开到R

无法将HDF5打开到R,r,R,我已成功加载到rhdf5包中,但无法打开文件并创建R数据帧。我读过,但仍然不清楚。我也尝试了hdfdump,但结果是错误的 如何读取HDF5文件?我知道我想要所有的列,不需要分组,而是想要一个完整的数据帧。谢谢我从中随机下载了文件“h5ex\u t\u string.h5”作为示例 读取.h5文件的方法如下: library(rhdf5) #load library h5ls("h5ex_t_string.h5") #this will show you the name to use b

我已成功加载到
rhdf5
包中,但无法打开文件并创建R数据帧。我读过,但仍然不清楚。我也尝试了
hdfdump
,但结果是错误的

如何读取HDF5文件?我知道我想要所有的列,不需要分组,而是想要一个完整的数据帧。谢谢

我从中随机下载了文件“h5ex\u t\u string.h5”作为示例

读取.h5文件的方法如下:

library(rhdf5)   #load library
h5ls("h5ex_t_string.h5")  #this will show you the name to use below in the argument

> h5ls("h5ex_t_string.h5")
  group name       otype dclass dim
0     /  DS1 H5I_DATASET STRING   4   #so the name is DS1

D = h5read("h5ex_t_string.h5",name='DS1') #use the filename and the name to read file

> D   #Weird message in the file but I randomly downloaded it 
[1] "Parting" "is such" "sweet  " "sorrow."
h5read函数返回一个数组,如果愿意,可以将其转换为data.frame

> a<-data.frame(D)
> a
        D
1 Parting
2 is such
3 sweet  
4 sorrow.
>a
D
1分
2就是这样
3甜的
4.悲伤。