Bug in rhdf5::h5write?
1
0
Entering edit mode
davis ▴ 90
@davis-8868
Last seen 6.6 years ago
United Kingdom

I think I might have found a bug in rhdf5. Namely, calling the following in a session where library(rhdf5) has *not* been run:
`rhdf5::h5write(donors, file = output_file, name = "sampleID")`
(where "donors" is a character vector) gives the following error:
```
Error in UseMethod("h5write") :
  no applicable method for 'h5write' applied to an object of class "character"
```

However calling the same thing after calling library(rhdf5) works fine. This was surprising to me. I could be missing something, but looks like a bug?

Session Info:
```
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.2 (Maipo)

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] zlibbioc_1.20.0 readr_1.0.0     assertthat_0.1  R6_2.2.0
[5] tools_3.3.2     pbdZMQ_0.2-5    rhdf5_2.18.0    tibble_1.2
[9] Rcpp_0.12.8
```

Best

Davis

rhdf5 • 1.6k views
ADD COMMENT
0
Entering edit mode
Mike Smith ★ 6.5k
@mike-smith
Last seen 22 hours ago
EMBL Heidelberg

I think this is because h5write isn't registered as an S3method.  When you haven't attached rhdf5 using library(), R looks for the appropriate method in the environment, and then in the database of registered methods, but it won't find it in either and fails.  Once you've run library() the h5write.default method can be found and it works.

I think this can be fixed by changing export(h5write.default) to S3method(h5write, default) in the packages NAMESPACE file.

ADD COMMENT

Login before adding your answer.

Traffic: 617 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6