Skip to content

Commit

Permalink
restructured vignettes and added git wflows
Browse files Browse the repository at this point in the history
  • Loading branch information
spedygiorgio committed Feb 25, 2024
1 parent ad0ab61 commit b5b292b
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.Rproj\.user
^\.travis\.yml$
^data-raw$
vignettes/jss*
Expand All @@ -8,3 +9,4 @@ vignettes/*.log
^TAGS$
^.*\.tar\.gz$
^LICENSE\.md$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion markovchain.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ LaTeX: pdfLaTeX
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageBuildArgs: --compact-vignettes=both --resave-data
PackageBuildArgs: --compact-vignettes=gs+qpdf --resave-data
PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace
17 changes: 13 additions & 4 deletions vignettes/gsoc_2017_additions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@
title: "Google Summer of Code 2017 Additions"
author: "Vandit Jain"
date: "August 2017"
output: rmarkdown::pdf_document
output: rmarkdown::html_vignette
bibliography: markovchainBiblio.bib
vignette: >
%\VignetteIndexEntry{Google Summer of Code 2017 Additions}
%\VignetteEngine{knitr::rmarkdown}
%VignetteEncoding{UTF-8}
pkgdown:
as_is: true
extension: pdf
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,
collapse = TRUE,
comment = "#>")
```

```{r setup_2, include=FALSE}
require(markovchain)
```



# Expected Hitting Time using CTMC

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]:
Expand Down
27 changes: 14 additions & 13 deletions vignettes/higher_order_markov_chains.Rmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
title:
plain: "Higher, possibly multivariate, Order Markov Chains in markovchain package"
formatted: "Higher, possibly multivariate, Order Markov Chains in \\pkg{markovchain} package"
short: "Higher order (multivariate) Markov chains"
plain: "Higher order Markov chains"
formatted: "Higher order Markov chains"
short: "Higher order Markov chains"
pagetitle: "Higher order (multivariate) Markov chains"
output: rmarkdown::html_vignette
author:
- name: "Deepak Yadav"
affiliation: B-Tech student, Computer Science and Engineering
Expand All @@ -18,7 +19,7 @@ author:
Gainesville, FL, USA
email: \email{tskang3@gmail.com}
- name: "Giorgio Alfredo Spedicato"
affiliation: Ph.D C.Stat ACAS, UnipolSai R\&D
affiliation: Ph.D FCAS FSA CSPA C.Stat, Unipol Group
address: >
Via Firenze 11
Paderno Dugnano 20037 Italy
Expand All @@ -33,20 +34,14 @@ preamble: >
\setkeys{Gin}{width=0.8\textwidth}
abstract: |
The \pkg{markovchain} package contains functions to fit higher (possibly) multivariate order Markov chains. The functions are shown as well as simple exmaples
output: if (rmarkdown::pandoc_version() < "2.2") function(...) { rmarkdown::pdf_document(template = "./template.tex", ...) } else function(...) { bookdown::pdf_book(base_format = rticles::jss_article, ...) }
vignette: >
%\VignetteIndexEntry{Higher order markov chains}
%\VignetteIndexEntry{Higher order Markov chains}
%\VignetteEngine{knitr::rmarkdown}
%VignetteEncoding{UTF-8}
keywords:
plain: [Higher order Markov chains]
formatted: [Higher order Markov chains]
documentclass: jss
classoption: nojss
bibliography: markovchainBiblio.bib
pkgdown:
as_is: true
extension: pdf
---

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

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

```{r load, results='hide', warning=FALSE, message=FALSE}
require(markovchain)
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,
collapse = TRUE,
comment = "#>")
```

```{r setup_2, include=FALSE, message=FALSE, echo=FALSE}
require(markovchain)
```


```{r higherOrder}
if (requireNamespace("Rsolnp", quietly = TRUE)) {
library(Rsolnp)
Expand Down

0 comments on commit b5b292b

Please sign in to comment.