Skip to content

Commit b5b292b

Browse files
committed
restructured vignettes and added git wflows
1 parent ad0ab61 commit b5b292b

File tree

8 files changed

+178
-18
lines changed

8 files changed

+178
-18
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
^.*\.Rproj$
22
^\.Rproj\.user$
3+
^\.Rproj\.user
34
^\.travis\.yml$
45
^data-raw$
56
vignettes/jss*
@@ -8,3 +9,4 @@ vignettes/*.log
89
^TAGS$
910
^.*\.tar\.gz$
1011
^LICENSE\.md$
12+
^\.github$

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

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

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

.github/workflows/pkgdown.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
release:
9+
types: [published]
10+
workflow_dispatch:
11+
12+
name: pkgdown
13+
14+
jobs:
15+
pkgdown:
16+
runs-on: ubuntu-latest
17+
# Only restrict concurrency for non-PR jobs
18+
concurrency:
19+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
20+
env:
21+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22+
permissions:
23+
contents: write
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: r-lib/actions/setup-pandoc@v2
28+
29+
- uses: r-lib/actions/setup-r@v2
30+
with:
31+
use-public-rspm: true
32+
33+
- uses: r-lib/actions/setup-r-dependencies@v2
34+
with:
35+
extra-packages: any::pkgdown, local::.
36+
needs: website
37+
38+
- name: Build site
39+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
40+
shell: Rscript {0}
41+
42+
- name: Deploy to GitHub pages 🚀
43+
if: github.event_name != 'pull_request'
44+
uses: JamesIves/github-pages-deploy-action@v4.5.0
45+
with:
46+
clean: false
47+
branch: gh-pages
48+
folder: docs

.github/workflows/test-coverage.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: test-coverage
10+
11+
jobs:
12+
test-coverage:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: r-lib/actions/setup-r@v2
21+
with:
22+
use-public-rspm: true
23+
24+
- uses: r-lib/actions/setup-r-dependencies@v2
25+
with:
26+
extra-packages: any::covr
27+
needs: coverage
28+
29+
- name: Test coverage
30+
run: |
31+
covr::codecov(
32+
quiet = FALSE,
33+
clean = FALSE,
34+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
35+
)
36+
shell: Rscript {0}
37+
38+
- name: Show testthat output
39+
if: always()
40+
run: |
41+
## --------------------------------------------------------------------
42+
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
43+
shell: bash
44+
45+
- name: Upload test results
46+
if: failure()
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: coverage-test-failures
50+
path: ${{ runner.temp }}/package

markovchain.Rproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ LaTeX: pdfLaTeX
1515
BuildType: Package
1616
PackageUseDevtools: Yes
1717
PackageInstallArgs: --no-multiarch --with-keep.source
18-
PackageBuildArgs: --compact-vignettes=both --resave-data
18+
PackageBuildArgs: --compact-vignettes=gs+qpdf --resave-data
1919
PackageCheckArgs: --as-cran
2020
PackageRoxygenize: rd,collate,namespace

vignettes/gsoc_2017_additions.Rmd

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,26 @@
22
title: "Google Summer of Code 2017 Additions"
33
author: "Vandit Jain"
44
date: "August 2017"
5-
output: rmarkdown::pdf_document
5+
output: rmarkdown::html_vignette
66
bibliography: markovchainBiblio.bib
77
vignette: >
88
%\VignetteIndexEntry{Google Summer of Code 2017 Additions}
99
%\VignetteEngine{knitr::rmarkdown}
1010
%VignetteEncoding{UTF-8}
11-
pkgdown:
12-
as_is: true
13-
extension: pdf
1411
---
1512

13+
```{r setup, include=FALSE}
14+
knitr::opts_chunk$set(echo = TRUE,
15+
collapse = TRUE,
16+
comment = "#>")
17+
```
18+
19+
```{r setup_2, include=FALSE}
20+
require(markovchain)
21+
```
22+
23+
24+
1625
# Expected Hitting Time using CTMC
1726

1827
The package provides `ExpectedTime` function to calculate average hitting time from one state to another. Let the final state be j, then for every state $i \in I$, where $I$ is the set of all possible states and holding time $q_{i} > 0$ for every $i \neq j$. Assuming the conditions to be true, expected hitting time is equal to minimal non-negative solution vector $p$ to the system of linear equations [@NorrisBook]:

vignettes/higher_order_markov_chains.Rmd

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22
title:
3-
plain: "Higher, possibly multivariate, Order Markov Chains in markovchain package"
4-
formatted: "Higher, possibly multivariate, Order Markov Chains in \\pkg{markovchain} package"
5-
short: "Higher order (multivariate) Markov chains"
3+
plain: "Higher order Markov chains"
4+
formatted: "Higher order Markov chains"
5+
short: "Higher order Markov chains"
66
pagetitle: "Higher order (multivariate) Markov chains"
7+
output: rmarkdown::html_vignette
78
author:
89
- name: "Deepak Yadav"
910
affiliation: B-Tech student, Computer Science and Engineering
@@ -18,7 +19,7 @@ author:
1819
Gainesville, FL, USA
1920
email: \email{tskang3@gmail.com}
2021
- name: "Giorgio Alfredo Spedicato"
21-
affiliation: Ph.D C.Stat ACAS, UnipolSai R\&D
22+
affiliation: Ph.D FCAS FSA CSPA C.Stat, Unipol Group
2223
address: >
2324
Via Firenze 11
2425
Paderno Dugnano 20037 Italy
@@ -33,20 +34,14 @@ preamble: >
3334
\setkeys{Gin}{width=0.8\textwidth}
3435
abstract: |
3536
The \pkg{markovchain} package contains functions to fit higher (possibly) multivariate order Markov chains. The functions are shown as well as simple exmaples
36-
output: if (rmarkdown::pandoc_version() < "2.2") function(...) { rmarkdown::pdf_document(template = "./template.tex", ...) } else function(...) { bookdown::pdf_book(base_format = rticles::jss_article, ...) }
3737
vignette: >
38-
%\VignetteIndexEntry{Higher order markov chains}
38+
%\VignetteIndexEntry{Higher order Markov chains}
3939
%\VignetteEngine{knitr::rmarkdown}
4040
%VignetteEncoding{UTF-8}
4141
keywords:
4242
plain: [Higher order Markov chains]
4343
formatted: [Higher order Markov chains]
44-
documentclass: jss
45-
classoption: nojss
4644
bibliography: markovchainBiblio.bib
47-
pkgdown:
48-
as_is: true
49-
extension: pdf
5045
---
5146

5247
```{r global_options, include=FALSE}
@@ -72,11 +67,17 @@ The output will be a `list` which consists of
7267

7368
Its quadratic programming problem is solved using `solnp` function of the Rsolnp package [@pkg:Rsolnp].
7469

75-
```{r load, results='hide', warning=FALSE, message=FALSE}
76-
require(markovchain)
70+
```{r setup, include=FALSE}
71+
knitr::opts_chunk$set(echo = TRUE,
72+
collapse = TRUE,
73+
comment = "#>")
74+
```
7775

76+
```{r setup_2, include=FALSE, message=FALSE, echo=FALSE}
77+
require(markovchain)
7878
```
7979

80+
8081
```{r higherOrder}
8182
if (requireNamespace("Rsolnp", quietly = TRUE)) {
8283
library(Rsolnp)

0 commit comments

Comments
 (0)