Open christystarr opened 5 years ago
Hi @christystarr , thanks for the bug report! Can you please provide a minimal reproducible example to help us investigate? e.g. from the example in the README
library(EML)
attributes <- read.table(system.file("extdata/hf205_attributes.csv", package = "EML"))
factors <- read.table(system.file("extdata/hf205_factors.csv", package = "EML"))
attributeList <-
set_attributes(attributes,
factors,
col_classes = c("character",
"Date",
"Date",
"Date",
"factor",
"factor",
"factor",
"numeric"))
and I do not get that error. Providing sessionInfo()
is also helpful for us in debugging to see differences in platform or version that may be responsible. e.g. here's what I see when I run sessionInfo()
:
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.4
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] EML_2.0.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 rstudioapi_0.10 knitr_1.22 xml2_1.2.0 magrittr_1.5 uuid_0.1-2
[7] tidyselect_0.2.5 R6_2.4.0 rlang_0.3.4 dplyr_0.8.0.1 tools_3.6.0 packrat_0.5.0
[13] xfun_0.7 jqr_1.1.0 htmltools_0.3.6 digest_0.6.18 yaml_2.2.0 lazyeval_0.2.2
[19] assertthat_0.2.1 jsonld_2.1 tibble_2.1.1 crayon_1.3.4 purrr_0.3.2 curl_3.3
[25] emld_0.2.0 glue_1.3.1 evaluate_0.13 rmarkdown_1.12 V8_2.2 compiler_3.6.0
[31] pillar_1.4.0 jsonlite_1.6 pkgconfig_2.0.2
Hello, Thanks for any help! It is within a larger program that converts excel table to eml (exceltoeml). I have debugged it down to this point below, where fact1 is the attributes if there are factors and meta1 is non-factors. The columns in these data frames are attributeName, attributeLabel, attributeDefinition, measurementScale,domain, storageType, and formatString.
The weird thing is that it worked last week. Then I loaded the new version of R and the associated packages, and now it does not work. Here is the code that gives that error message. Mainly the second half, since I don't have any factors.
if (dim(fact1)[1] > 0) { attributeList <- set_attributes(meta1,factors=fact1) } else { attributeList <- set_attributes(meta1) }
| >
@christystarr Thanks for sessionInfo()
, this confirms you are working on the latest version. Yes, the new version is not the same as the old version and some things may break after you upgraded; sorry.
Yes, I understand that your error probably comes from a larger script, unfortunately that's not something we can debug. Please provide code which I can copy-paste into R to reproduce the error. This may require creating a smaller example set of attributes by removing complexity from your code. Please see https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for a quick overview of this! Without it we really can't be much help.
FWIW I can recreate this error when I have a typo setting my eml_db options (and yes I have solved my own problems but just in case others haven't and stumble across this and/or you want to make a more informative error message for invalid eml_db options)
library(EML)
attributes <- read.table(system.file("extdata/hf205_attributes.csv", package = "EML"))
factors <- read.table(system.file("extdata/hf205_factors.csv", package = "EML"))
#works fine
attributeList <-
set_attributes(attributes,
factors,
col_classes = c("character",
"Date",
"Date",
"Date",
"factor",
"factor",
"factor",
"numeric"))
#also works find if I change to another version of eml
options(emld_db = "eml-2.1.1")
attributeList <-
set_attributes(attributes,
factors,
col_classes = c("character",
"Date",
"Date",
"Date",
"factor",
"factor",
"factor",
"numeric"))
options("emld_db" = "eml-2.2.0")
attributeList <-
set_attributes(attributes,
factors,
col_classes = c("character",
"Date",
"Date",
"Date",
"factor",
"factor",
"factor",
"numeric"))
#generates readBin error when you make a typo in your eml version
options("emld_db" = "a typo")
attributeList <-
set_attributes(attributes,
factors,
col_classes = c("character",
"Date",
"Date",
"Date",
"factor",
"factor",
"factor",
"numeric"))
That's perfect, thanks @scelmendorf, makes this straightforward to track down.
@cboettig: (1) I think a more helpful error message should be produced higher up the call stack and (2) we should probably keep iterating on the API for changing/setting the EML version (something like emld::eml_version
since we can't do any input validation on an options
call. Thoughts?
Hello! I had that error a while back. I no longer work at that job or have the same computer. This was so long ago that I kind of forget (although I recall being annoyed at the time about the error). Sorry I can't be of more help.
Christy
On Mon, Jun 22, 2020 at 2:36 PM Bryce Mecum notifications@github.com wrote:
That's perfect, thanks @scelmendorf https://github.com/scelmendorf, makes this straightforward to track down.
@cboettig https://github.com/cboettig: (1) I think a more helpful error message should be produced higher up the call stack and (2) we should probably keep iterating on the API for changing/setting the EML version (something like emld::eml_version since we can't do any input validation on an options call. Thoughts?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ropensci/EML/issues/277#issuecomment-647756640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIN6SRJRQ5JMUZ5WHWD2SKLRX66FRANCNFSM4HODUYYA .
I am not sure if this is a problem with the EML package or some other package but when I try to run set_attributes I get the message Error in readBin(4L, raw(0), 32768L) : can only read from a binary connection
I can not figure out what I am doing wrong.