gtools is orphaned - Consider a replacement?
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 199
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
Hi shinystan team,
We noticed that gtools is orphaned https://cran.r-project.org/web/packages/gtools/index.html, we were wondering if you'd consider replacing your usage of it with something else.
It seems that you use gtools::mixedsort() to ensure that sorting is done correctly with respect to numeric character strings.
I'm not sure the comment there is correct, because sort() works as you expect on that specific example. However, it does matter when you sort strings like c("1", "2", "10") because the 10 will come before the 2 with typical sort methods. You could use stringi instead of gtools for this purpose if you are looking for a good replacement:
# Small numbers aren't a problem with base sort()
x <- c("beta[1,1]", "beta[1,2]", "beta[2,1]", "beta[2,2]")
sort(x)
#> [1] "beta[1,1]" "beta[1,2]" "beta[2,1]" "beta[2,2]"
gtools::mixedsort(x)
#> [1] "beta[1,1]" "beta[1,2]" "beta[2,1]" "beta[2,2]"
# Maybe it was for this?
x <- c("beta[1,1]", "beta[2,1]", "beta[10,1]")
sort(x)
#> [1] "beta[1,1]" "beta[10,1]" "beta[2,1]"
gtools::mixedsort(x)
#> [1] "beta[1,1]" "beta[2,1]" "beta[10,1]"
# You can sort that "correctly" with stringi instead
stringi::stri_sort(x, numeric = TRUE)
#> [1] "beta[1,1]" "beta[2,1]" "beta[10,1]"
Created on 2022-06-16 by the reprex package (v2.0.1)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with inst/ShinyStan/server_files/utilities/make_param_list_with_groups_sort.R and inspect the use of gtools::mixedsort(). Compare a replacement's behavior on the numeric-string examples in the issue; done means the orphaned dependency is no longer needed and parameter names still sort numerically as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100