Skip to content

Error H5type is set in h5createAttribute() #162

@lazappi

Description

@lazappi

If I try to create an attribute using h5createAttribute() with the H5type argument set I get an error:

path <- tempfile(fileext = ".h5")
file <- rhdf5::H5Fcreate(path)

rhdf5::h5write(
  1:10,
  name = "test",
  file = file
)
  
rhdf5::h5createAttribute(
  "test",
  attr = "test_attr",
  dims = 1,
  file = file,
  H5type = "H5T_STD_I32LE"
)
#> Error in rhdf5::h5createAttribute("test", attr = "test_attr", dims = 1, : object 'tid' not found

Created on 2025-06-26 with reprex v2.1.1

I think it's because nothing is matched here

rhdf5/R/h5create.R

Lines 566 to 568 in fced3af

if(grepl(pattern = "^[[:digit:]]+$", H5type)) {
tid <- H5type
}

Perhaps it could use .setDataType() like in h5createDataset()? Or alternatively, I've misunderstood something and this isn't supposed to work.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions