Skip to content

Commit 76fe623

Browse files
committed
Initial release of sampleselection 0.1.2
0 parents  commit 76fe623

32 files changed

Lines changed: 2932 additions & 0 deletions

.Rbuildignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
^sampleselection\.Rproj$
2+
^\.Rproj\.user$
3+
^\.DS_Store$
4+
^\.github$
5+
^\.gitignore$
6+
^docs$
7+
^examples$
8+
^CONTRIBUTING\.md$
9+
^NEWS\.md$

.github/workflows/R-CMD-check.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches: [main, master]
4+
pull_request:
5+
6+
name: R-CMD-check
7+
8+
permissions: read-all
9+
10+
jobs:
11+
R-CMD-check:
12+
runs-on: ${{ matrix.config.os }}
13+
14+
name: ${{ matrix.config.os }} (R ${{ matrix.config.r }})
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
config:
20+
- {os: macos-latest, r: 'release'}
21+
- {os: windows-latest, r: 'release'}
22+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
23+
- {os: ubuntu-latest, r: 'release'}
24+
- {os: ubuntu-latest, r: 'oldrel-1'}
25+
26+
env:
27+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
28+
R_KEEP_PKG_SOURCE: yes
29+
30+
steps:
31+
- uses: actions/checkout@v6
32+
33+
- uses: r-lib/actions/setup-pandoc@v2
34+
35+
- uses: r-lib/actions/setup-r@v2
36+
with:
37+
r-version: ${{ matrix.config.r }}
38+
http-user-agent: ${{ matrix.config.http-user-agent }}
39+
use-public-rspm: true
40+
41+
- uses: r-lib/actions/setup-r-dependencies@v2
42+
with:
43+
extra-packages: any::rcmdcheck
44+
needs: check
45+
46+
- uses: r-lib/actions/check-r-package@v2
47+
with:
48+
upload-snapshots: true

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.Rhistory
2+
.RData
3+
.Ruserdata
4+
.Rproj.user/
5+
*.Rcheck/
6+
*.tar.gz
7+
.DS_Store

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 参与贡献
2+
3+
欢迎通过 Issue 报告问题,或通过 Pull Request 改进代码和文档。
4+
5+
报告问题时,建议附上:
6+
7+
- `sessionInfo()` 的输出;
8+
- 可以重现问题的最小示例,优先使用 `simulate_sample_data()`
9+
- 完整报错信息;
10+
- 预期行为与实际行为。
11+
12+
请勿上传包含个人信息、商业秘密或未经脱敏的真实研究数据。
13+
14+
提交代码前,请在包目录的上一级运行:
15+
16+
```r
17+
R CMD build sampleselection
18+
R CMD check sampleselection_*.tar.gz --no-manual
19+
```

DESCRIPTION

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Package: sampleselection
2+
Type: Package
3+
Title: Sample Selection Demonstrations for Regression Teaching
4+
Version: 0.1.2
5+
Authors@R: person("YuLi", role = c("aut", "cre"),
6+
email = "36653380+JINGYIYIYIYI@users.noreply.github.com")
7+
Description: Provides reusable functions that demonstrate how outcome-driven
8+
observation deletion or downweighting can alter regression conclusions.
9+
The package supports fixed effects, clustered standard errors, multiple
10+
coefficient targets, interactions, instrumental variables, transformations,
11+
winsorization, simulated teaching data, case extraction, model refitting,
12+
and explicit exports. It is
13+
intended solely for research-methods teaching and must not be used to select
14+
samples for substantive empirical research.
15+
License: MIT + file LICENSE
16+
URL: https://github.com/JINGYIYIYIYI/sampleselection
17+
BugReports: https://github.com/JINGYIYIYIYI/sampleselection/issues
18+
Encoding: UTF-8
19+
Depends: R (>= 4.1.0)
20+
Imports:
21+
fixest
22+
Suggests:
23+
haven,
24+
testthat (>= 3.0.0)
25+
Config/testthat/edition: 3
26+
Roxygen: list(markdown = TRUE)
27+
RoxygenNote: 7.3.3

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2026
2+
COPYRIGHT HOLDER: YuLi

NAMESPACE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
S3method(print,auto_sample_search_result)
4+
S3method(print,sample_selection_trials)
5+
export(auto_sample_search)
6+
export(best_case)
7+
export(export_search_result)
8+
export(extract_case_data)
9+
export(format_search_results)
10+
export(refit_case)
11+
export(simulate_sample_data)

NEWS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# sampleselection 0.1.2
2+
3+
- 新增 `simulate_sample_data()`,所有教程均改用模拟数据。
4+
- 改进搜索结果的打印格式,使用中文列名和易读的 p 值。
5+
- 新增 `format_search_results()`,便于生成适合查看或导出的结果表。
6+
- 新增完整中文教程、参数说明、进阶示例和常见问题。
7+
- 新增 GitHub Actions 多平台 R CMD check。
8+
9+
# sampleselection 0.1.1
10+
11+
- 将原 Shiny 工作流整理为可重复调用的 R 函数。
12+
- 增加案例提取、重新估计和结果导出功能。
13+
14+
# sampleselection 0.1.0
15+
16+
- 首个包版本。

R/package.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#' sampleselection: Sample Selection Demonstrations for Regression Teaching
2+
#'
3+
#' `sampleselection` provides a reusable function interface for demonstrating
4+
#' how outcome-driven observation deletion or downweighting can change
5+
#' regression conclusions. It is intended only for research-methods teaching.
6+
#'
7+
#' @section Ethical use:
8+
#' Do not use search results from this package to select samples for papers,
9+
#' referee responses, or substantive robustness analyses. Sample rules for real
10+
#' research should be fixed before results are inspected.
11+
#'
12+
#' @keywords internal
13+
"_PACKAGE"

0 commit comments

Comments
 (0)