Skip to content

Commit

Permalink
Few changes about the naming convention of {tm}
Browse files Browse the repository at this point in the history
  • Loading branch information
m-l-1 committed Feb 16, 2020
1 parent 162a548 commit aac5ccc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
10 changes: 5 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ htmltools::tagList(rmarkdown::html_dependency_font_awesome())
[![Travis-CI build status](https://travis-ci.org/Novartis/tidymodules.svg?branch=master)](https://travis-ci.org/Novartis/tidymodules)
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)

The tidymodules R package is built on top of shiny modules using R6 to provide a new object-oriented programming (OOP) approach for module development, new module interface using input/output ports and a set of tidy operators for handling cross-module communication.
The `{tidymodules}` R package is built on top of shiny module using R6 to provide a new object-oriented programming (OOP) approach for module development, new module interface using input/output ports and a set of tidy operators for handling cross-module communication.

The main features of tidymodules and its comparison with conventional Shiny modules are presented in the table below.

Expand All @@ -39,7 +39,7 @@ The main features of tidymodules and its comparison with conventional Shiny modu

## Installation

You can install the most recent version of *tidymodules* from [GitHub](https://github.com/Novartis/tidymodules) with:
You can install the most recent version of `{tidymodules}` from [GitHub](https://github.com/Novartis/tidymodules) with:

``` r
library(devtools)
Expand All @@ -61,13 +61,13 @@ Some examples have been deployed on shinyapp.io, such as:

## Learning More

Please review the [Get Started](https://opensource.nibr.com/tidymodules/articles/tidymodules.html) page for a high level introduction to tidymodules and its usage in developing Shiny apps.
Please review the [Get Started](https://opensource.nibr.com/tidymodules/articles/tidymodules.html) page for a high level introduction to `{tidymodules}` and its usage in developing Shiny apps.

If you are interested to develop modules using tidymodules, we recommend reading the vignettes under "Articles".
If you are interested to develop modules using `{tidymodules}`, we recommend reading the vignettes under "Articles".

## Code of Conduct

Please note that the *tidymodules* package 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 `{tidymodules}` is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.

## Acknowledgment

Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<!-- README.md is generated from README.Rmd. Please edit that file -->

tidymodules <img src="man/figures/logo.svg" align="right" height="139" />
=========================================================================

[![Travis-CI build
status](https://travis-ci.org/Novartis/tidymodules.svg?branch=master)](https://travis-ci.org/Novartis/tidymodules)
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)

The tidymodules R package is built on top of shiny modules using R6 to
provide a new object-oriented programming (OOP) approach for module
The `{tidymodules}` R package is built on top of shiny module using R6
to provide a new object-oriented programming (OOP) approach for module
development, new module interface using input/output ports and a set of
tidy operators for handling cross-module communication.

Expand Down Expand Up @@ -69,7 +68,7 @@ Shiny modules are presented in the table below.
Installation
------------

You can install the most recent version of *tidymodules* from
You can install the most recent version of `{tidymodules}` from
[GitHub](https://github.com/Novartis/tidymodules) with:

library(devtools)
Expand Down Expand Up @@ -99,18 +98,18 @@ Learning More

Please review the [Get
Started](https://opensource.nibr.com/tidymodules/articles/tidymodules.html)
page for a high level introduction to tidymodules and its usage in
page for a high level introduction to `{tidymodules}` and its usage in
developing Shiny apps.

If you are interested to develop modules using tidymodules, we recommend
reading the vignettes under “Articles”.
If you are interested to develop modules using `{tidymodules}`, we
recommend reading the vignettes under “Articles”.

Code of Conduct
---------------

Please note that the *tidymodules* package 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 `{tidymodules}` is released with a [Contributor
Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project,
you agree to abide by its terms.

Acknowledgment
--------------
Expand Down
28 changes: 14 additions & 14 deletions vignettes/intro.Rmd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
pagetitle: "Getting started with writing tidymodules"
title: "Getting started with writing tidymodules"
pagetitle: "Getting started with writing `{tidymodules}`"
title: "Getting started with writing `{tidymodules}`"
subtitle: "<div style='float:right;'><i style='color:#285fa4;' class='fas fa-laptop-code fa-4x'></i></div>"
author: "Xiao Ni, Mustapha Larbaoui"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Getting started with writing tidymodules}
%\VignetteIndexEntry{Getting started with writing `{tidymodules}`}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand All @@ -21,15 +21,15 @@ knitr::opts_chunk$set(

## A quick introduction to R6 and Object Oriented Programming (OOP)

Tidymodules is based R6 ([https://r6.r-lib.org/](https://r6.r-lib.org/)), which is an implementation of encapsulated object-oriented programming for R. Therefore knowledge of R6 is a prerequisite for using tidymodules to develop Shiny modules.
`{tidymodules}` or `{tm}` in short, is based on R6 ([https://r6.r-lib.org/](https://r6.r-lib.org/)), which is an implementation of encapsulated object-oriented programming for R. Therefore knowledge of R6 is a prerequisite to develop `{tm}` modules.

R6 provides a framework for OOP in R. Unlike the functional programming style, R6 encapsulate methods and fields in classes that instantiate into objects. R6 classes are similar to R's reference classes, but are more efficient and do not depend on S4 classes and the methods package.
R6 provides a framework for OOP in R. Unlike the functional programming style, R6 encapsulates methods and fields in classes that instantiate into objects. R6 classes are similar to R's reference classes, but are more efficient and do not depend on S4 classes and the methods package.

This vignette provides a brief overview of R6 for developers new to R6. For more information, developers are recommended to review the R6 packagedown site ([https://r6.r-lib.org/](https://r6.r-lib.org/)), as well as Chapter 14 of the Advanced R book ([https://adv-r.hadley.nz/r6.html](https://adv-r.hadley.nz/r6.html))

### R6 classes and methods

Tidymodules depends on the R6 package which you can install from CRAN and load:
`{tm}` depends on the R6 package which you can install from CRAN and load:
```{r , eval=FALSE}
library(R6)
```
Expand Down Expand Up @@ -89,11 +89,11 @@ Below are some key features of R6.

## `tidymodules::TidyModule` class

The `tidymodules::TidyModule` class inherits from `R6Class` and is the parent of all tidymodules modules.
The `tidymodules::TidyModule` class is a R6 class and the parent of all `{tm}` modules.

Below is partial code of the `TidyModule` class for illustration purpose. `TidyModule` includes public methods such as `ui()`, `server()`, `callModules()`, and `definePorts()` etc.
Below is partial code of the `TidyModule` class for illustration purpose. The `TidyModule` class includes many public methods. There are utility functions such as `callModules()`, `definePorts()`, `assignPort()` as well as functions that need to be overwritten such as `ui()`, `server()`, etc.

Unlike conventional Shiny modules in funtional programming style, tidymodules encapsulates functions such as ui() and server() as methods in a TidyModule class object. Module namespace ID is seamlessly managed within the module class for the ui and server. For complete technical documentation include other methods and fields, see `?TidyModule`.
Unlike conventional Shiny modules in funtional programming style, `{tm}` encapsulates functions such as ui() and server() as methods in a TidyModule class object. Module namespace ID is seamlessly managed within the module class for the ui and server. For complete technical documentation that includes other methods and fields, see `?TidyModule`.
```{r, eval=FALSE}
TidyModule <- R6::R6Class(
"TidyModule",
Expand Down Expand Up @@ -144,11 +144,11 @@ TidyModule <- R6::R6Class(



## Writing your first tidymodules Shiny module
## Writing your first `{tm}` module

You can develop new tidymodules Shiny modules by inheriting and extending the `tidymodules::TidyModule` class.
You can develop new `{tm}` modules by inheriting and extending the `tidymodules::TidyModule` class.

Below is a minimal example, `RandomNumberGenerator`, with one input port and one output port. The input port is a random number seed that feeds into a random number generator, whose result serves as the module output.
Below is a minimal example, `RandomNumberGenerator`, defined with one input port and one output port. The input port is a random number seed that feeds into a random number generator, whose result serves as the module output.

```{r}
# Module definition
Expand Down Expand Up @@ -203,7 +203,7 @@ RandomNumMod <- R6::R6Class(
)
```

Cross-communication between two tidymodules modules is established using several flavours of the pipe `%>%` operator, as illustrated in the following code. The first module's output is fed as the random number seed for the second module.
Cross-communication between two `{tm}` modules is established using several flavours of the pipe `%>%` operator, as illustrated in the following code. The first module's output is fed as the random number seed for the second module.
```{r, eval=FALSE}
## Calling app
randomNumMod1 <- RandomNumMod$new()
Expand Down Expand Up @@ -232,5 +232,5 @@ shinyApp(ui = ui, server = server)

## Next steps

To learn more about writing tidymodules modules, read the examples.
To learn more about writing `{tm}` modules, read the examples.

0 comments on commit aac5ccc

Please sign in to comment.