-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting problems when trying to do a basic print of epidist. #301
Comments
The problem appears to come from that on some operating systems (and or R versions) calling |
Interesting issue - I'm interested to know why Line 579 in 7f69ecf
epiparameter/R/epidist_utils.R Line 399 in 7f69ecf
doi rather than DOI . Not sure what the fix should be though.
|
Thanks for posting this @jlessler. I've not encountered this before, and I'm not able to reproduce locally (on mac). It may be an issue with running R on linux, or potentially on the specific version of R/linux stated in your In diagnosing the problem I've checked that the case insensitive matching is not standard behaviour for lists in R. lst = list(first = 1, second = 2)
lst$fir
#> [1] 1
lst$first
#> [1] 1
lst$FIRST
#> NULL
lst$firsts
#> NULL Created on 2024-05-24 with reprex v2.1.0 Reproducing the code example above I also get case insensitive matching when accessing elements of the citation library(epiparameter)
db <- epidist_db()
#> Returning 122 results that match the criteria (99 are parameterised).
#> Use subset to filter by entry variables or single_epidist to return a single entry.
#> To retrieve the citation for each use the 'get_citation' function
db
#> List of <epidist> objects
#> Number of entries in library: 122
#> Number of studies in library: 47
#> Number of diseases: 23
#> Number of delay distributions: 112
#> Number of offspring distributions: 10
db[[1]]$citation$DOI
#> [1] "10.1016/S1473-3099(09)70069-6"
db[[1]]$citation$Doi
#> [1] "10.1016/S1473-3099(09)70069-6"
db[[1]]$citation$doi
#> [1] "10.1016/S1473-3099(09)70069-6" Created on 2024-05-24 with reprex v2.1.0 This seems to be due to the way R creates and accesses This can be seen if I create a dummy bib = bibentry(
bibtype = "article",
author = "smith",
year = 2000,
title = "a title",
journal = "a journal",
DOI = "dfhbdshjdbs",
PMID = 102897823
)
unclass(bib)
#> [[1]]
#> [[1]]$author
#> [1] "smith"
#>
#> [[1]]$year
#> [1] "2000"
#>
#> [[1]]$title
#> [1] "a title"
#>
#> [[1]]$journal
#> [1] "a journal"
#>
#> [[1]]$doi
#> [1] "dfhbdshjdbs"
#>
#> [[1]]$pmid
#> [1] "102897823"
#>
#> attr(,"bibtype")
#> [1] "Article" Created on 2024-05-24 with reprex v2.1.0 The @jfunction I hope this brings some light to the issue, see #317 for the fix, although I'm still not sure on what is the underlying difference causing this on some OSs/R versions. Overall, this issue should now be resolved. If you continue to experience this issue or have a similar issue please feel free to reopen this issue or open a new one. |
Thanks to the awesome sleuthing above I was able to get to the bottom of this without too much additional effort and just wanted to report back. The underlying issue was that the patch fixing the case insensitive values issue was made 2 years ago as part of R 4.2.0 but Ubuntu is still stuck on 4.1.2 see here. Note the NEWS says it's for version 4.2.0. I also confirmed with |
Please place an "x" in all the boxes that apply
Please include a brief description of the problem with a code example:
Get a error when I try to print epidist_db
I get the following error:
ERROR while rich displaying an object: Error in vapply(x, function(y) y$citation$DOI, FUN.VALUE = character(1)): values must be length 1,
but FUN(X[[1]]) result is length 0
This is my R version:
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
Sys.info:
Sys.info()
sysname release
"Linux" "5.15.146.1-microsoft-standard-WSL2"
version nodename
"#1 SMP Thu Jan 11 04:09:03 UTC 2024" "JLesslerYoga"
machine login
"x86_64"
The text was updated successfully, but these errors were encountered: