Skip to content

Commit

Permalink
Merge pull request #235 from greta-dev/rc_0_3_0
Browse files Browse the repository at this point in the history
v0.3.0 release candidate
  • Loading branch information
goldingn authored Oct 30, 2018
2 parents 3a064ec + dd5e855 commit 2ebaf15
Show file tree
Hide file tree
Showing 306 changed files with 26,508 additions and 48,164 deletions.
121 changes: 121 additions & 0 deletions .EDIT_WEBSITE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# building and contributing to the greta website

This document explains how [the greta website](https://greta-stats.org) is built, and how to edit website content or add an analysis case study or an example model. Before you submit a pull request, please [open a GitHub issue](https://github.com/greta-dev/greta/issues/new) describing the content you'd like to change or add, and discuss it with the package maintainers.

## building the website

*greta* uses a customised [pkgdown](http://pkgdown.r-lib.org/) setup to build the greta website at [https://greta-stats.org](). This setup does not create the [greta forum](https://forum.greta-stats.org), which uses [discourse](https://www.discourse.org/) running on [a cloud server](https://www.digitalocean.com/docs/one-clicks/discourse/).

Due to [a small bug in pkgdown](https://github.com/r-lib/pkgdown/pull/834), the build currently only works with fork of the main pkgdown repo. You can install that version with:

```
devtools::install_github("goldingn/pkgdown@rmd_home_template")
```

To rebuild the website, change your working directory to the top of the
*greta* repository, and use the pkgdown `build_site()` function from within R:

```
pkgdown::build_site()
```

This will update the `docs` directory. You then need to commit those changes to the `git` repository, and push to github.

The greta website is hosted by [netlify](https://www.netlify.com/), which will update the website after the files are pushed.

## customising pkgdown

The greta website build makes use of pkgdown's ability to customise templates, css, and the `_pkgdown.yml` configuration file, see the [`build_site()` documentation](http://pkgdown.r-lib.org/reference/build_site.html) for details.

The page templates are stored in `inst/pkgdown/templates`, and the custom css is at `inst/pkgdown/assets/pkgdown.css`. The `index.Rmd` file also contains a small amount of html code to align the example on the home page.

## updating existing pages

The main website pages can be edited by making changes to Rmarkdown documents and re-building the website:

To change ... | Edit ...
--------------------|------------------------
Home page example | `index.Rmd`
get started | `vignettes/get_started.Rmd`
contribute | `vignettes/webpages/contribute.Rmd`
software | `vignettes/webpages/software.Rmd`
technical details | `vignettes/webpages/technical_details.Rmd`
why greta | `vignettes/webpages/why_greta.Rmd`


## adding analysis case studies

To add an analysis case study, upload an Rmarkdown document to the `vignettes/analyses` folder, and edit 'menu' in the 'analyses' entry in the 'navbar' section of `_pkgdown.yml`, providing a short title and a relative path to the rendered output. E.g.:
```
- text: my analysis
href: articles/analyses/my_analysis.html
```

## adding example models

Example models should show how to define greta arrays representing a general type of statistical model, using an example dataset. They should not contain calls to `model()`, or any plotting or inference on models. Each example model is in a self-contained Rmarkdown file.

To add an example model, create an R markdown file with the following components:

### title

Short, and s a level-3 header.

### brief introductory text

No more than a paragraph, please!

### data section

If needed, a level-4 header 'data' and a code chunk defining the data. The code chunk must have the chunk argument `highlight=FALSE`, and a chunk name that differs from the other example models and ends in `_data`. If the dataset is included with base R, this section can be omitted.

### greta code section

A level-4 header 'greta code' and an R code chunk defining the model in greta. The chunk name must that differ from the other example models and end in `_greta`.

### BUGS/JAGS code

If relevant, a level-4 header 'BUGS/JAGS code' and a (non-R) markdown code chunk giving the equivalent model in BUGS/JAGS code. The code block should be surrounded by an html `div` command defining a 'bugs' environment, which is used for code formatting.

### Stan code
If relevant, a level-4 header 'Stan code' and an R code chunk (with chunk argument `echo=FALSE`) with an R command to read in the equivalent model from the [Stan example models repository](https://github.com/stan-dev/example-models). The chunk name must that differ from the other example models and end in `_stan`. The code block should be surrounded by an html `div` command defining the Stan code formatting.

###

Here's a template:
````
### my example model
introduce the model here
#### data
```{r my_example_data, highlight = FALSE}
```
#### greta code
```{r my_example_greta}
```
### BUGS/JAGS code
<div class="bugs">
```
```
</div>
### Stan code
<div class="stan">
```{r my_example_stan, echo = FALSE}
cat(readLines('https://raw.githubusercontent.com/stan-dev/example-models/master/ < path / to / model / code >.stan'), sep = '\n')
```
</div>
````

This should be saved as an .Rmd file with a meaningful name in the directory `inst/examples`. To add the example to the website, edit `vignettes/example_models.Rmd`, to add a horizontal rule and a code chunk in the relevant section, loading your example file as a child document. E.g.:

````
<hr>
```{r child='../inst/examples/my_example.Rmd'}
```
````

12 changes: 7 additions & 5 deletions README.Rmd → .README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ knitr::include_graphics('README_files/top_banner.png')

greta lets you write your own model like in BUGS, JAGS and Stan, except that you write models right in R, it scales well to massive datasets, and it's easy to extend and build on.

### See the [website](https://greta-dev.github.io/greta/) for more information, [tutorials](https://greta-dev.github.io/greta/get_started.html), [examples](https://greta-dev.github.io/greta/example_models.html), and [package documentation](https://greta-dev.github.io/greta/reference-index.html).
### See the [website](https://greta-stats.org/) for more information, including [tutorials](https://greta-stats.org/get_started.html), [examples](https://greta-stats.org/example_models.html), [package documentation](https://greta-stats.org/reference-index.html),
and the [greta forum](https://forum.greta-stats.org).

You can install the current release version of the package (0.2.5) from GitHub:
You can install the current release version of the package (0.3.0) from CRAN:
```r
install.packages("greta")
```
or the development version from GitHub:
```r
devtools::install_github("greta-dev/greta")
```

I would love to hear any feedback, bug reports or feature requests via the [issues tracker](https://github.com/greta-dev/greta/issues). I would also be very keen for contributions from anyone with time to spare!


[![build status](https://travis-ci.org/greta-dev/greta.svg?branch=master)](https://travis-ci.org/greta-dev/greta)
[![codecov.io](https://codecov.io/github/greta-dev/greta/coverage.svg?branch=master)](https://codecov.io/github/greta-dev/greta?branch=master)
[![cran version](http://www.r-pkg.org/badges/version/greta)](https://cran.rstudio.com/web/packages/greta)
Expand Down
49 changes: 34 additions & 15 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
^_pkgdown\.yml$
^.github$
^.netlify$
^.lintr$
^.travis.yml$
^docs$
^.*\.Rproj$
^\.Rproj\.user$
LICENSE
README.Rmd
README.md
README_files
README_cache
logos
.travis.yml
docs
man/figures/plot_greta_legend.R
cran-comments.md
vignettes/build_vignettes.R
vignettes/example_models_cache
vignettes/get_started_cache
vignettes/technical_details_cache
vignettes/get_started_files

^CODE_OF_CONDUCT\.md$
^\.EDIT_WEBSITE\.md$
^LICENSE$
^cran-comments\.md$

^logos$
^inst/pkgdown$

^index\.Rmd$
^index_files$
^index_cache$
^index\.md$

^README\.Rmd$
^\.README\.Rmd$
^README\.md$
^README_files$
^README_cache$

^vignettes/get_started_cache$
^vignettes/example_models_cache$
^vignettes/webpages$
^vignettes/analyses$

^man/figures/vis-1\.png$
^man/figures/plot_greta_legend\.R$

46 changes: 46 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing to greta

We love receiving contributions to greta! To make the prcoess as smooth as
possible, this outlines how to propose a change to greta. It's based on the
contributing guidelines for the tidyverse project.

### Fixing typos

Small typos or grammatical errors in documentation may be edited directly using
the GitHub web interface, so long as the changes are made in the _source_ file.

* YES: you edit a roxygen comment in a `.R` file below `R/`.
* NO: you edit an `.Rd` file below `man/`.

### Prerequisites

Before you make a substantial pull request, you should always file an issue and
make sure someone from the team agrees that it’s a problem. If you’ve found a
bug, create an associated issue and illustrate the bug with a minimal
[reprex](https://www.tidyverse.org/help/#reprex).

### Pull request process

* We recommend that you create a Git branch for each pull request (PR).
* Look at the Travis and AppVeyor build status before and after making changes.
The `README` should contain badges for any continuous integration services used
by the package.
* New code should follow the tidyverse [style guide](http://style.tidyverse.org).
You can use the [styler](https://CRAN.R-project.org/package=styler) package to
apply these styles, but please don't restyle code that has nothing to do with
your PR.
* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with
[Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/markdown.html),
for documentation.
* We use [testthat](https://cran.r-project.org/package=testthat). Contributions
with test cases included are easier to accept.
* For user-facing changes, add a bullet to the top of `NEWS.md` below the
current development version header describing the changes made followed by your
GitHub username, and links to relevant issue(s)/PR(s).

### Code of Conduct

Please note that the greta 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.

13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Please briefly describe your problem and what output you expect.

If you have a question, please don't use this form. Instead, ask on <https://forum.greta-stats.org/>.

Please include a minimal reproducible example (AKA a reprex). If you've never heard of a [reprex](http://reprex.tidyverse.org/) before, start by reading <https://www.tidyverse.org/help/#reprex>.

---

Brief description of the problem

```r
# insert reprex here
```
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
.RData
.Ruserdata

README_cache
vignettes/example_models_cache
vignettes/get_started_cache
vignettes/technical_details_cache
*_cache
*_files

vignettes/figures
vignette/figures

*.pdf
docs/*.Rmd
docs/examples
docs/*_cache
cran-comments.md
4 changes: 4 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
linters: with_defaults(commas_linter = NULL, object_usage_linter = NULL)
exclude: "# Exclude Linting"
exclude_start: "# Begin Exclude Linting"
exclude_end: "# End Exclude Linting"
1 change: 1 addition & 0 deletions .netlify
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"site_id":"03e9a74b-bfe7-4279-9666-10e43f5af467","path":"docs"}
39 changes: 37 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,41 @@ language: r
warnings_are_errors: false
dist: trusty

# enable RELEASE_CANDIDATE to run (slow & fragile) tests of sampler validity before releases
env:
global:
- RELEASE_CANDIDATE=false
- LINTR_COMMENT_BOT=false
- secure: cZMk6ONjL+YQ/NjJRujeCsZqnq8+avQ3LunQWp699cMvtWRqF1E6m3kxh9uTHExMduifTreNl7Fn7mPDRSJot5fBi1AMK15yRX4I/W0HSXm5hmdoZAxQCBXEy2Tcd5a6URE9epv0UBFPeWqnI7KHoXwR6BI9R6/kiRbnJJQbS+HItVUXIXfoX57ur5ujlh44JLT6It/p/J5R1nAJDMbjKPifVSxbXF+PMEWrVdJKqaN3IJVXBOYHICf0vQ+sXncF6xsYoYw7B76ZGUHgxF6u+pPCBjMDtmtIiJ9ucE7AnJcQNn4d8ehEimlU5OtEP7uVyJLR2TdDQb/4PIkXKAAT/KrXoDapZYayuBh4ROrPiswlWUp5E+CP5MzOBz4s8V8jlj9qLhJC5Asy8egyQ7BMK0a9Ei4C5vwvumfO+91NhNmsWJPR6T4NW+ea1btWsMwFDFlLewekKYL4qdM+H17pFs0lbkfqk3lqWd3Bhr/0uCTcJLQd8pVdT8IMouBoZBYGl6NztYecpEsl9YeF5wB/seG8HMZQ1wvGXiGyI7RXdDNb32+qMBWErbvQkqSqy7rXgLl0zvxERkjIuyCbIviEHdZPPKbX3P06+Cqd+iIGmuGSNEVTcjYe97rKFNC8eCud1VcEkk+h/nkB3bJLwMD1zjfHRJpCKR3Eh6Oh5ulDgyE=

r_binary_packages:
- abind
- coda
- codetools
- colorspace
- DBI
- digest
- foreign
- ggplot2
- inline
- lattice
- MASS
- MCMCpack
- mgcv
- mvtnorm
- nlme
- plyr
- Rcpp
- rpart
- rstan
- stringr
- survival
- XML

r_packages:
- reticulate
- tensorflow
- R6
- coda
- testthat
- covr
- DiagrammeR
Expand All @@ -17,6 +47,8 @@ r_packages:
- bayesplot
- extraDistr
- devtools
- tidyverse
- lintr

r_github_packages:
- rich-iannone/DiagrammeRsvg
Expand All @@ -41,10 +73,13 @@ addons:

before_install:
- pip install --user numpy
- pip install --user 'tensorflow==1.7'
- pip install --user scipy
- pip install --user 'tensorflow==1.10'
- pip install --user 'tensorflow-probability'

after_success:
- Rscript -e "covr::codecov()"
- Rscript -e "lintr::lint_package()"

email:
on_success: change
Expand Down
25 changes: 25 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or
imagery, derogatory comments or personal attacks, trolling, public or private harassment,
insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant
(http://contributor-covenant.org), version 1.0.0, available at
http://contributor-covenant.org/version/1/0/0/
Loading

0 comments on commit 2ebaf15

Please sign in to comment.