Skip to content

Commit

Permalink
Repo (branch "master") filled with shinybrms 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fweber144 committed Mar 20, 2020
0 parents commit 62d4cf6
Show file tree
Hide file tree
Showing 14 changed files with 2,011 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
^shinybrms\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
^NEWS\.Rmd$
^cran-comments\.md$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.Rproj.user
28 changes: 28 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Roxygen: list(markdown = TRUE)
Package: shinybrms
Title: Graphical User Interface (Shiny App) for Package "brms"
Version: 1.0.0
Date: 2020-03-20
Authors@R:
person(given = "Frank",
family = "Weber",
role = c("aut", "cre"),
email = "fweber144@protonmail.com")
Description: This package provides a graphical user interface (GUI) for the
package "brms" which allows to fit Bayesian regression models using Stan
(https://mc-stan.org/) (more specifically, using its R interface, the
package "rstan"). The GUI is a Shiny app, i.e. created using the package
"shiny".
License: GPL-3
URL: https://github.com/fweber144/shinybrms
BugReports: https://github.com/fweber144/shinybrms/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.0.2
Depends: R (>= 3.5.0)
Imports:
shiny (>= 1.4.0),
brms (>= 2.12.0)
Suggests:
shinystan (>= 2.5.0),
callr (>= 3.4.2)
595 changes: 595 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(launch_shinybrms)
11 changes: 11 additions & 0 deletions NEWS.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
output: github_document
---

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

# News for package "shinybrms"

## shinybrms 1.0.0

First release. Offers support for Bayesian regression models with a Gaussian, Bernoulli or negative binomial distribution for the (univariate) outcome. Currently, only "fixed" (a.k.a. non-varying or population-level) effects are supported for the predictors. "Random" (a.k.a. varying or group-level) effects are not supported yet. Neither supported are most of [**brms**](https://cran.r-project.org/web/packages/brms/index.html)'s other features, like monotonic effects for ordinal predictors or non-linear effects. Interactions are supported, though. For the inspection of the output, only a short summary (from `brms::summary.brmsfit()`) and the possibility to launch [**shinystan**](https://cran.r-project.org/web/packages/shinystan/index.html) is offered.
20 changes: 20 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

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

# News for package “shinybrms”

## shinybrms 1.0.0

First release. Offers support for Bayesian regression models with a
Gaussian, Bernoulli or negative binomial distribution for the
(univariate) outcome. Currently, only “fixed” (a.k.a. non-varying or
population-level) effects are supported for the predictors. “Random”
(a.k.a. varying or group-level) effects are not supported yet. Neither
supported are most of
[**brms**](https://cran.r-project.org/web/packages/brms/index.html)’s
other features, like monotonic effects for ordinal predictors or
non-linear effects. Interactions are supported, though. For the
inspection of the output, only a short summary (from
`brms::summary.brmsfit()`) and the possibility to launch
[**shinystan**](https://cran.r-project.org/web/packages/shinystan/index.html)
is offered.
54 changes: 54 additions & 0 deletions R/launch_shinybrms.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#' @title Launch the \pkg{shinybrms} Shiny app
#'
#' @description This function launches the \pkg{shinybrms} Shiny app.
#'
#' @param launch.browser Argument `launch.browser` from [shiny::runApp()]. Defaults here to
#' `interactive()`.
#' @param \dots Further arguments passed to [shiny::runApp()]. For example, in order to force
#' launching the Shiny app in the system's default web browser, set argument `launch.browser` to
#' `TRUE`.
#'
#' @note If option `mc.cores` is set, then the advanced option "Cores" defaults to the value of this
#' option. If option `mc.cores` is not set, then the advanced option "Cores" defaults to the value
#' returned by [parallel::detectCores()].
#'
#' By default, the [Stan](https://mc-stan.org/) progress automatically opens up as an HTML file.
#' This behavior may be disabled in the "Advanced options" of the \pkg{shinybrms} Shiny app
#' (option "Open progress"), but for the remainder of this paragraph, it is assumed that the
#' automatic opening of the Stan progress file is desired. In RStudio, the default for option
#' `browser` cannot be used for the Stan progress file. Therefore, \pkg{shinybrms} has an option
#' `shinybrms.browser_RStudio` specifying the value for option `browser` to be used when running
#' in RStudio. If not specified, option `shinybrms.browser_RStudio` defaults to `NULL`. On
#' Windows, `NULL` means that the default browser (as determined by the file association
#' mechanism) is used. On non-Windows systems, `NULL` has no meaning and automatically disables
#' the advanced option "Open progress" from the \pkg{shinybrms} app internally (with a
#' notification popping up) if not done by the user. On any system, option
#' `shinybrms.browser_RStudio` may directly specify the HTML browser to use (see argument
#' `browser` in [utils::browseURL()] and option `browser` in [base::options()] for details).
#'
#' The option `shinybrms.browser_RStudio` (see above) is also used when launching the
#' \pkg{shinystan} Shiny app and running in RStudio. Here, the default (`NULL`) makes it
#' impossible to launch the \pkg{shinystan} app if running on a non-Windows system (and in
#' RStudio).
#'
#' @return `TRUE` (invisible).
#'
#' @export
#'
#' @examples
#' \donttest{
#' launch_shinybrms()
#' }

launch_shinybrms <- function(launch.browser = interactive(), ...){
app_path <- system.file("shinybrms_app", package = "shinybrms")
if(identical(app_path, "")){
stop("Path to package \"shinybrms\" could not be found. Try re-installing package \"shinybrms\".")
}
shiny::runApp(
appDir = app_path,
launch.browser = launch.browser,
...
)
return(invisible(TRUE))
}
35 changes: 35 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# Description

This [R](https://www.r-project.org/) package **shinybrms** provides a graphical user interface (GUI) for the package [**brms**](https://cran.r-project.org/web/packages/brms/index.html) which allows to fit Bayesian regression models using [Stan](https://mc-stan.org/) (more specifically, using its R interface, the package [**rstan**](https://cran.r-project.org/web/packages/rstan/index.html)). The GUI is a [Shiny](https://shiny.rstudio.com/) app, i.e. created using the package [**shiny**](https://cran.r-project.org/web/packages/shiny/index.html).

# Installation

If not already done, you need to install R first (see the [R homepage](https://www.r-project.org/)). Then, in R, perform the following steps:

1. Install the package [**rstan**](https://cran.r-project.org/web/packages/rstan/index.html) (see [this GitHub page](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started) for instructions).
2. Install the package **shinybrms** with the following command:
```{r, eval = FALSE}
devtools::install_github("fweber144/shinybrms")
```

# Usage

In R, launch the **shinybrms** Shiny app by typing:

```{r example, eval = FALSE}
library(shinybrms)
launch_shinybrms()
```
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# Description

This [R](https://www.r-project.org/) package **shinybrms** provides a
graphical user interface (GUI) for the package
[**brms**](https://cran.r-project.org/web/packages/brms/index.html)
which allows to fit Bayesian regression models using
[Stan](https://mc-stan.org/) (more specifically, using its R interface,
the package
[**rstan**](https://cran.r-project.org/web/packages/rstan/index.html)).
The GUI is a [Shiny](https://shiny.rstudio.com/) app, i.e. created using
the package
[**shiny**](https://cran.r-project.org/web/packages/shiny/index.html).

# Installation

If not already done, you need to install R first (see the [R
homepage](https://www.r-project.org/)). Then, in R, perform the
following steps:

1. Install the package
[**rstan**](https://cran.r-project.org/web/packages/rstan/index.html)
(see [this GitHub
page](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started)
for instructions).

2. Install the package **shinybrms** with the following command:

``` r
devtools::install_github("fweber144/shinybrms")
```

# Usage

In R, launch the **shinybrms** Shiny app by typing:

``` r
library(shinybrms)
launch_shinybrms()
```
11 changes: 11 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Test environments

* R 3.6.2 on local Windows 10 x64 (build 18363) system

## R CMD check results

There were no ERRORs or WARNINGs or NOTEs.

## Downstream dependencies

There are no packages depending on **shinybrms**.
Loading

0 comments on commit 62d4cf6

Please sign in to comment.