发布于 2014-11-20 00:52:18
我从h5ex_t_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.https://stackoverflow.com/questions/27029659
复制相似问题