Skip to content

Commit

Permalink
Code coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaneplusplus committed Jun 14, 2021
1 parent b9901fd commit 510b4f6
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 87 deletions.
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ Imports:
yaml,
fs
Suggests:
DT,
ggplot2,
testthat,
purrr,
knitr
DT,
ggplot2,
testthat,
purrr,
knitr,
covr
Enhances:
workflowr
URL: https://github.com/kaneplusplus/listdown
Expand Down
157 changes: 75 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,39 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->



# listdown

<!-- badges: start -->

[![](https://www.r-pkg.org/badges/version/listdown?color=blue)](https://cran.r-project.org/package=listdown)
[![R-CMD-check](https://github.com/kaneplusplus/listdown/workflows/R-CMD-check/badge.svg)](https://github.com/kaneplusplus/listdown/actions)
[![Codecov test coverage](https://codecov.io/gh/kaneplusplus/listdown/branch/master/graph/badge.svg)](https://codecov.io/gh/kaneplusplus/listdown?branch=master)
<!-- badges: end -->

## Overview

The {listdown} package provides functions to programmatically create R
Markdown files from named lists. It is intended for data analysis
pipelines where the presentation of the results is separated from their
creation. For this use case, a data processing (or analysis) is
performed and the results are provided in a single named list, organized
hierarchically. With the list and a {listdown} object a workflowr, pdf,
word, or html page. List element names denote sections, subsections,
subsubsection, etc. and the list elements contain the data structure to
be presented including graphs and tables. The goal of the package is not
to provide a finished, readable document. It is to provide a document
with all tables and visualization that will appear (*computational*
components). This serves as a starting point from which a user can
organize outputs, describe a study, discuss results, and provide
conclusions (*narrative* components).

{listdown} provides a reproducible means for producing a document with
specified computational components. It is most compatible with data
analysis pipelines where the data format is fixed but the analyses are
either being updated, which may affect narrative components including
the result discussion and conclusion, or where the experiment is
different, which affects all narrative components If the narrative
components are not changing with the data being pushed through your
analysis pipeline, then you may be better off writing the R Markdown
code manually.
## Overview

The {listdown} package provides functions to programmatically create R Markdown files from
named lists. It is intended for data analysis pipelines where the presentation of the results
is separated from their creation. For this use case, a data processing (or analysis) is performed
and the results are provided in a single named list, organized hierarchically. With the list and a {listdown} object a workflowr, pdf, word, or html page. List element names denote sections, subsections,
subsubsection, etc. and the list elements contain the data structure to be presented including
graphs and tables. The goal of the package is not to provide a finished, readable document. It is to provide a document with all tables and visualization that will appear (_computational_ components). This serves as a starting point from which a user can organize outputs, describe a study, discuss results, and provide conclusions (_narrative_ components).

{listdown} provides a reproducible means for producing a document with specified computational components. It is most compatible with data analysis pipelines where the data format is fixed but the analyses are either being updated, which may affect narrative components including the result discussion and conclusion, or where the experiment is different, which affects all narrative components If the narrative components are not changing with the data being pushed through your analysis pipeline, then you may be better off writing the R Markdown code manually.

## Installation

You can install the released version of listdown from
[CRAN](https://CRAN.R-project.org) with:
You can install the released version of listdown from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("listdown")
```

The development version of {listdown} can be installed from
[GitHub](https://github.com/) with:
The development version of {listdown} can be installed from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
Expand All @@ -55,15 +42,14 @@ devtools::install_github("kaneplusplus/listdown")

## Example

As a toy example, suppose we would like to create an html document
plotting Anscombe’s quartet with each plot having it’s own section. To
construct the document, we will need to two objects. The first is a
presentation list, whose names indicate section (or subsection) titles
and whose elements are the objects to present. The second is a
`listdown` object, which describes how the object should be rendered in
the document.
As a toy example, suppose we would like to create an html document plotting Anscombe's quartet with
each plot having it's own section. To construct the document, we will need to two objects. The first
is a presentation list, whose names indicate section (or subsection) titles and whose elements are
the objects to present. The second is a `listdown` object, which describes how the object should
be rendered in the document.

``` r

```r
library(listdown)
library(ggplot2)

Expand Down Expand Up @@ -94,54 +80,59 @@ doc <- c(
cat(paste(doc, collapse = "\n"))
```

#> ---
#> title: Anscombe's Quartet
#> author: Francis Anscombe
#> date: '1973'
#> output: html_document
#> ---
#>
#> ```{r}
#> library(ggplot2)
#>
#> cc_list <- readRDS("pres-list.rds")
#> ```
#>
#> # Linear
#>
#> ```{r}
#> cc_list$Linear
#> ```
#>
#> # Non Linear
#>
#> ```{r}
#> cc_list$`Non Linear`
#> ```
#>
#> # Outlier Vertical
#>
#> ```{r}
#> cc_list$`Outlier Vertical`
#> ```
#>
#> # Outlier Horizontal
#>
#> ```{r}
#> cc_list$`Outlier Horizontal`
#> ```

The document can then be written to a file, rendered, and viewed with
the following code.

``` r
```
#> ---
#> title: Anscombe's Quartet
#> author: Francis Anscombe
#> date: '1973'
#> output: html_document
#> ---
#>
#> ```{r}
#> library(ggplot2)
#>
#> cc_list <- readRDS("pres-list.rds")
#> ```
#>
#> # Linear
#>
#> ```{r}
#> cc_list$Linear
#> ```
#>
#> # Non Linear
#>
#> ```{r}
#> cc_list$`Non Linear`
#> ```
#>
#> # Outlier Vertical
#>
#> ```{r}
#> cc_list$`Outlier Vertical`
#> ```
#>
#> # Outlier Horizontal
#>
#> ```{r}
#> cc_list$`Outlier Horizontal`
#> ```
```

The document can then be written to a file, rendered, and viewed with the following code.


```r
library(rmarkdown)

writeLines(doc, file("anscombe.Rmd"))
render("anscombe.Rmd")
browseURL("anscombe.html")
```



<!--
## Example
Expand All @@ -156,6 +147,8 @@ library(listdown)

## Code of Conduct

Please note that the {listdown} project is released with a [Contributor
Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project,
you agree to abide by its terms.
Please note that the {listdown} project is released with a
[Contributor Code of Conduct](CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.


1 change: 1 addition & 0 deletions README.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ knitr::opts_chunk$set(
<!-- badges: start -->
[![](https://www.r-pkg.org/badges/version/listdown?color=blue)](https://cran.r-project.org/package=listdown)
[![R-CMD-check](https://github.com/kaneplusplus/listdown/workflows/R-CMD-check/badge.svg)](https://github.com/kaneplusplus/listdown/actions)
[![Codecov test coverage](https://codecov.io/gh/kaneplusplus/listdown/branch/master/graph/badge.svg)](https://codecov.io/gh/kaneplusplus/listdown?branch=master)
<!-- badges: end -->

## Overview
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ coverage:
default:
target: auto
threshold: 1%
informational: true
patch:
default:
target: auto
threshold: 1%
informational: true

0 comments on commit 510b4f6

Please sign in to comment.