Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

gtools is orphaned - Consider a replacement?

オープン
#196 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
r
領域
tooling

調査の方向性

inst/ShinyStan/server_files/utilities/make_param_list_with_groups_sort.R から始めて、gtools::mixedsort() の使用箇所を調べます。Issue にある数値文字列の例に対する置き換えの動作を比較します。完了条件は、孤立した依存関係が不要になり、パラメーター名が意図どおり数値順にソートされることです。

索引モデルが issue の本文から書いたものです。

説明

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.

https://github.com/stan-dev/shinystan/blob/e35c8174aad2bcef0a9faa103e2e0fcee3d6220c/inst/ShinyStan/server_files/utilities/make_param_list_with_groups_sort.R#L26-L28

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)

主要言語
R
スター
200
フォーク
47
平均マージ
1日 17時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stan-dev/shinystan のほかの issue

stan-dev/shinystan の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。