hdf5r icon indicating copy to clipboard operation
hdf5r copied to clipboard

Issue declaring "dtype" in create_attr()

Open Bryanrt-geophys opened this issue 3 years ago • 0 comments

I am trying to create an h5 with one group. In the group, there are numerous objects of 3x6000 matrices. Each matrix is to have 35 attributes. I have the object names, the attribute names, and the attribute values all in lists of equal size. I have successfully used furrr::future_pwalk() to create and populate the attributes for each matrix using a function like this:

furrr::future_pwalk(as.list(info), function(trace_name, col_names, value){
      h5attr(data.grp[[trace_name]], col_names) <- value
    })

However, this creates all attributes with the dtype==array despite some of the attributes being float32 or str.

I just saw in the vignettes that there is the function create_attr() that allows a user to declare dtype. However, there were no examples given. When I attempted this:

data.grp[[info$trace_name[1]]]$create_attr(attr_name = info$col_names[1], robj = info$value[1], dtype = class(info$value[1]))

I keep receiving this error,

Error in dtype$id : $ operator is invalid for atomic vectors

Would you be able to provide me with some examples of this function used properly or point me to where it is? Thank you kindly.

Bryan

Bryanrt-geophys avatar May 17 '21 01:05 Bryanrt-geophys