Skip to content

Commit b425fe2

Browse files
committed
Initial commit of forecastbaselines R package
R interface to ForecastBaselines.jl providing 10 baseline forecasting models with comprehensive uncertainty quantification and seamless integration with scoringutils evaluation framework. Features: - 10 forecasting models (Constant, ARMA, ETS, STL, etc.) - Probabilistic forecasting with multiple interval methods - S3 methods for scoringutils integration - Data transformations with automatic back-transformation - Comprehensive test suite (185 tests passing) Authors: Manuel Stapper and Sebastian Funk
0 parents  commit b425fe2

File tree

82 files changed

+8138
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+8138
-0
lines changed

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

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
schedule:
9+
- cron: '5 4 * * 1'
10+
pull_request:
11+
branches:
12+
- main
13+
- master
14+
merge_group:
15+
workflow_dispatch:
16+
17+
name: R-CMD-check
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
R-CMD-check:
25+
if: "! contains(github.event.head_commit.message, '[ci skip]')"
26+
runs-on: ${{ matrix.config.os }}
27+
28+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
config:
34+
- {os: macOS-latest, r: 'release'}
35+
- {os: windows-latest, r: 'release'}
36+
- {os: ubuntu-latest, r: 'release'}
37+
- {os: ubuntu-latest, r: 'oldrel-1'}
38+
39+
env:
40+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
41+
R_KEEP_PKG_SOURCE: yes
42+
NOT_CRAN: true
43+
44+
steps:
45+
- uses: actions/checkout@v5
46+
47+
- uses: julia-actions/setup-julia@v2
48+
with:
49+
version: '1.9'
50+
51+
- name: Cache Julia packages
52+
uses: julia-actions/cache@v2
53+
with:
54+
cache-name: julia-cache-artifacts
55+
cache-compiled: true
56+
57+
- uses: r-lib/actions/setup-pandoc@v2
58+
59+
- uses: r-lib/actions/setup-r@v2
60+
with:
61+
r-version: ${{ matrix.config.r }}
62+
http-user-agent: ${{ matrix.config.http-user-agent }}
63+
use-public-rspm: true
64+
65+
- uses: r-lib/actions/setup-r-dependencies@v2
66+
with:
67+
extra-packages: any::rcmdcheck, local::.
68+
needs: check
69+
70+
- name: Install JuliaCall dependencies (Unix)
71+
if: runner.os != 'Windows'
72+
run: |
73+
export R_HOME=$(R RHOME)
74+
julia -e 'ENV["R_HOME"] = raw"'"$R_HOME"'"; using Pkg; Pkg.add("RCall"); Pkg.build("RCall")'
75+
shell: bash
76+
77+
- name: Install JuliaCall dependencies (Windows)
78+
if: runner.os == 'Windows'
79+
run: |
80+
$env:R_HOME = (& R.exe RHOME | Out-String).Trim()
81+
julia -e "ENV[`"R_HOME`"] = raw`"$env:R_HOME`"; using Pkg; Pkg.add(`"RCall`"); Pkg.build(`"RCall`")"
82+
shell: pwsh
83+
84+
- name: Preload Julia's libunwind (Linux workaround)
85+
if: runner.os == 'Linux'
86+
run: |
87+
# Workaround for JuliaCall issue #238
88+
# Ubuntu's libunwind 1.6.2 has bugs. Preload Julia's own libunwind instead.
89+
JULIA_LIBUNWIND=$(find $(julia -e 'print(Sys.BINDIR)')/../lib/julia -name "libunwind.so.8*" 2>/dev/null | head -1)
90+
if [ -n "$JULIA_LIBUNWIND" ]; then
91+
echo "Preloading Julia's libunwind: $JULIA_LIBUNWIND"
92+
echo "LD_PRELOAD=$JULIA_LIBUNWIND" >> $GITHUB_ENV
93+
else
94+
echo "Warning: Julia's libunwind not found, may segfault"
95+
fi
96+
shell: bash
97+
98+
- name: Setup Julia dependencies
99+
run: |
100+
ForecastBaselineR::setup_ForecastBaselines(verbose = TRUE)
101+
shell: Rscript {0}
102+
103+
- uses: r-lib/actions/check-r-package@v2
104+
with:
105+
upload-snapshots: true
106+
error-on: '"error"'
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
name: lint-changed-files
10+
11+
jobs:
12+
lint-changed-files:
13+
runs-on: ubuntu-latest
14+
if: "! contains(github.event.head_commit.message, '[ci skip]')"
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
steps:
18+
- uses: actions/checkout@v5
19+
20+
- uses: r-lib/actions/setup-r@v2
21+
22+
- uses: r-lib/actions/setup-r-dependencies@v2
23+
with:
24+
extra-packages: |
25+
any::gh
26+
any::lintr
27+
any::purrr
28+
needs: lint
29+
30+
- name: Add lintr options
31+
run: |
32+
cat('\noptions(lintr.linter_file = ".lintr")\n', file = "~/.Rprofile", append = TRUE)
33+
shell: Rscript {0}
34+
35+
- name: Install package
36+
run: R CMD INSTALL .
37+
38+
- name: Extract and lint files changed by this PR
39+
run: |
40+
files <- gh::gh("GET https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files")
41+
changed_files <- purrr::map_chr(files, "filename")
42+
all_files <- list.files(recursive = TRUE)
43+
exclusions_list <- as.list(setdiff(all_files, changed_files))
44+
lintr::lint_package(exclusions = exclusions_list)
45+
shell: Rscript {0}
46+
env:
47+
LINTR_ERROR_ON_LINT: true

.github/workflows/pkgdown.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
tags: ['*']
7+
merge_group:
8+
workflow_dispatch:
9+
10+
name: pkgdown
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
pkgdown:
18+
runs-on: ubuntu-latest
19+
# Only restrict concurrency for non-PR jobs
20+
concurrency:
21+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
22+
env:
23+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24+
permissions:
25+
contents: write
26+
steps:
27+
- uses: actions/checkout@v5
28+
29+
- uses: julia-actions/setup-julia@v2
30+
with:
31+
version: '1.9'
32+
33+
- name: Cache Julia packages
34+
uses: julia-actions/cache@v2
35+
with:
36+
cache-name: julia-cache-artifacts
37+
cache-compiled: true
38+
39+
- uses: r-lib/actions/setup-pandoc@v2
40+
41+
- uses: r-lib/actions/setup-r@v2
42+
with:
43+
use-public-rspm: true
44+
45+
- uses: r-lib/actions/setup-r-dependencies@v2
46+
with:
47+
extra-packages: any::pkgdown, local::.
48+
needs: website
49+
50+
- name: Install JuliaCall dependencies
51+
run: |
52+
export R_HOME=$(R RHOME)
53+
julia -e 'ENV["R_HOME"] = raw"'"$R_HOME"'"; using Pkg; Pkg.add("RCall"); Pkg.build("RCall")'
54+
shell: bash
55+
56+
- name: Preload Julia's libunwind (Linux workaround)
57+
run: |
58+
# Workaround for JuliaCall issue #238
59+
# Ubuntu's libunwind 1.6.2 has bugs. Preload Julia's own libunwind instead.
60+
JULIA_LIBUNWIND=$(find $(julia -e 'print(Sys.BINDIR)')/../lib/julia -name "libunwind.so.8*" 2>/dev/null | head -1)
61+
if [ -n "$JULIA_LIBUNWIND" ]; then
62+
echo "Preloading Julia's libunwind: $JULIA_LIBUNWIND"
63+
echo "LD_PRELOAD=$JULIA_LIBUNWIND" >> $GITHUB_ENV
64+
else
65+
echo "Warning: Julia's libunwind not found, may segfault"
66+
fi
67+
shell: bash
68+
69+
- name: Setup Julia dependencies
70+
run: |
71+
ForecastBaselineR::setup_ForecastBaselines(verbose = TRUE)
72+
shell: Rscript {0}
73+
74+
- name: Build site
75+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
76+
shell: Rscript {0}
77+
78+
- name: Deploy to GitHub pages 🚀
79+
if: github.event_name != 'pull_request'
80+
uses: JamesIves/github-pages-deploy-action@v4.7.4
81+
with:
82+
clean: false
83+
branch: gh-pages
84+
folder: docs
85+
single-commit: true
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: render-readme
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.head_ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
render-readme:
15+
runs-on: macos-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- name: Checkout repos
20+
uses: actions/checkout@v5
21+
22+
- name: Setup R
23+
uses: r-lib/actions/setup-r@v2
24+
25+
- name: Setup pandoc
26+
uses: r-lib/actions/setup-pandoc@v2
27+
28+
- name: Install dependencies
29+
uses: r-lib/actions/setup-r-dependencies@v2
30+
with:
31+
packages: any::rmarkdown, ropensci/allcontributors
32+
33+
- name: Update contributors
34+
if: github.ref == 'refs/heads/main'
35+
continue-on-error: true
36+
run: |
37+
tryCatch(
38+
allcontributors::add_contributors(format = "text"),
39+
error = function(e) {
40+
message("Warning: Failed to update contributors: ", e$message)
41+
message("Continuing without contributor update...")
42+
}
43+
)
44+
shell: Rscript {0}
45+
46+
- name: Compile the readme
47+
run: |
48+
rmarkdown::render("README.Rmd")
49+
shell: Rscript {0}
50+
51+
- name: Upload README.md as an artifact
52+
uses: actions/upload-artifact@v5
53+
with:
54+
name: readme
55+
path: README.md
56+
57+
- name: Create Pull Request
58+
if: github.ref == 'refs/heads/main'
59+
uses: peter-evans/create-pull-request@v7
60+
with:
61+
commit-message: "Automatic README update"
62+
title: "Update README"
63+
body: "This is an automated pull request to update the README."
64+
branch: "update-readme-${{ github.run_number }}"
65+
labels: "documentation"
66+
add-paths: |
67+
README.Rmd
68+
README.md
69+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
merge_group:
9+
workflow_dispatch:
10+
11+
name: test-coverage
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
test-coverage:
19+
runs-on: macos-latest
20+
if: "! contains(github.event.head_commit.message, '[ci skip]')"
21+
env:
22+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
NOT_CRAN: true
24+
25+
steps:
26+
- uses: actions/checkout@v5
27+
28+
- uses: julia-actions/setup-julia@v2
29+
with:
30+
version: '1.9'
31+
32+
- name: Cache Julia packages
33+
uses: julia-actions/cache@v2
34+
with:
35+
cache-name: julia-cache-artifacts
36+
cache-compiled: true
37+
38+
- uses: r-lib/actions/setup-pandoc@v2
39+
40+
- uses: r-lib/actions/setup-r@v2
41+
with:
42+
use-public-rspm: true
43+
44+
- uses: r-lib/actions/setup-r-dependencies@v2
45+
with:
46+
extra-packages: any::covr, local::.
47+
needs: coverage
48+
49+
- name: Install JuliaCall dependencies
50+
run: |
51+
export R_HOME=$(R RHOME)
52+
julia -e 'ENV["R_HOME"] = raw"'"$R_HOME"'"; using Pkg; Pkg.add("RCall"); Pkg.build("RCall")'
53+
shell: bash
54+
55+
- name: Setup Julia dependencies
56+
run: |
57+
ForecastBaselineR::setup_ForecastBaselines(verbose = TRUE)
58+
shell: Rscript {0}
59+
60+
- name: Test coverage
61+
env:
62+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
63+
run: covr::codecov(quiet = FALSE)
64+
shell: Rscript {0}

0 commit comments

Comments
 (0)