Skip to content

Commit

Permalink
Add a save_slides() function
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Jul 12, 2019
1 parent 111d677 commit b61b42c
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 34 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -3,6 +3,7 @@
export(launch_app)
export(save_app)
export(save_notebooks)
export(save_slides)
export(view_slides)
importFrom(drake,drake_plan)
importFrom(drake,make)
Expand Down
6 changes: 3 additions & 3 deletions R/notebooks.R
Expand Up @@ -3,13 +3,13 @@
#' and supporting files.
#' @export
#' @seealso [view_slides()], [launch_app()]
#' @param path Character, where to write the files
#' @param overwrite Logical, whether to over
#' @param path Character, where to write the files.
#' @param overwrite Logical, whether to overwrite the files.
#' @examples
#' \dontrun{
#' save_notebooks()
#' }
save_notebooks <- function(path = "learndrake", overwrite = FALSE) {
save_notebooks <- function(path = "learndrake-notebooks", overwrite = FALSE) {
origin <- system.file("notebooks", package = "learndrake", mustWork = TRUE)
fs::dir_copy(path = origin, new_path = path, overwrite = overwrite)
invisible()
Expand Down
19 changes: 18 additions & 1 deletion R/slides.R
@@ -1,7 +1,24 @@
#' @title Save the introductory slides
#' @description Save the slides to a folder.
#' @export
#' @seealso [view_slides()], [save_notebooks()], [launch_app()]
#' @param path Character, where to write the files.
#' @param overwrite Logical, whether to overwrite the files.
#' @examples
#' \dontrun{
#' save_slides()
#' }
save_slides <- function(path = "learndrake-slides", overwrite = FALSE) {
origin <- system.file("slides", package = "learndrake", mustWork = TRUE)
fs::dir_copy(path = origin, new_path = path, overwrite = overwrite)
invisible()
}


#' @title View the introductory slides
#' @description Open the slides in a web browser.
#' @export
#' @seealso [save_notebooks()], [launch_app()]
#' @seealso [save_slides()], [save_notebooks()], [launch_app()]
#' @param browse Logical, whether to actually view the slides.
#' For testing purposes only.
#' @examples
Expand Down
15 changes: 8 additions & 7 deletions README.Rmd
Expand Up @@ -4,11 +4,11 @@ output: github_document

[![Travis build status](https://travis-ci.org/wlandau/learndrake.svg?branch=master)](https://travis-ci.org/wlandau/learndrake)
[![Codecov test coverage](https://codecov.io/gh/wlandau/learndrake/branch/master/graph/badge.svg)](https://codecov.io/gh/wlandau/learndrake?branch=master)
[![Launch Rstudio Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wlandau/learndrake/binder?urlpath=rstudio)
[![Launch RStudio Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wlandau/learndrake/binder?urlpath=rstudio)

# Machine learning workflow management with drake
# Reproducible workflows at scale with `drake`

Machine learning workflows can be difficult to manage. A single round of computation can take several hours to complete, and routine updates to the code and data tend to invalidate hard-earned results. You can enhance the maintainability, hygiene, speed, scale, and reproducibility of such projects with the [`drake`](https://github.com/ropensci/drake) R package. [`drake`](https://github.com/ropensci/drake) resolves the dependency structure of your analysis pipeline, skips tasks that are already up to date, executes the rest with [optional distributed computing](https://ropenscilabs.github.io/drake-manual/hpc.html), and organizes the output so you rarely have to think about data files. This workshop will teach you how to create and maintain machine learning projects with [`drake`](https://github.com/ropensci/drake)-powered automation.
Ambitious workflows in R, such as machine learning analyses, can be difficult to manage. A single round of computation can take several hours to complete, and routine updates to the code and data tend to invalidate hard-earned results. You can enhance the maintainability, hygiene, speed, scale, and reproducibility of such projects with the [`drake`](https://github.com/ropensci/drake) R package. [`drake`](https://github.com/ropensci/drake) resolves the dependency structure of your analysis pipeline, skips tasks that are already up to date, executes the rest with [optional distributed computing](https://ropenscilabs.github.io/drake-manual/hpc.html), and organizes the output so you rarely have to think about data files. This workshop will teach you how to create and maintain machine learning projects with [`drake`](https://github.com/ropensci/drake)-powered automation.

# Installation

Expand All @@ -23,18 +23,19 @@ keras::install_keras()

# Usage: browser

Just click this badge: [![Launch Rstudio Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wlandau/learndrake/binder?urlpath=rstudio). Your browser will open the materials in a free RStudio Server instance. The exercises are in the notebooks (`1-churn/1-churn.Rmd`, `2-setup/2-setup.Rmd`, etc.).
Just click this badge: [![Launch RStudio Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wlandau/learndrake/binder?urlpath=rstudio). Your browser will open the materials in a free RStudio Server instance. The exercises are in the notebooks (`1-churn/1-churn.Rmd`, `2-setup/2-setup.Rmd`, etc.).

# Usage: local

The functions in `learndrake` help navigate and deploy the workshop materials. If you installed the package and dependencies as above, you can take the workshop locally without an internet connection.
The functions in `learndrake` help navigate and deploy the workshop materials. If you installed the package and dependencies as above, you can take the workshop locally without an internet connection. Start with the introductory slides, then move on to the notebooks. Launch apps along the way as directed.

Function | Purpose
---|---
`view_slides()` | Open the introductory slides in a web browser.
`save_notebooks()` | Save the tutorials to your computer: R notebooks and supporting files.
`launch_app()` | Launch a Shiny app that accompanies a tutorial.
`save_app()` | Save the app files so you can deploy to [shinyapps.io](https://www.shinyapps.io) or [Shiny Server](https://www.rstudio.com/products/shiny/shiny-server).
`save_notebooks()` | Save the tutorials to your computer: R notebooks and supporting files.
`save_slides()` | Save the introductory slides to your computer.
`view_slides()` | Open the introductory slides in a web browser.

# Introductory slides

Expand Down
36 changes: 20 additions & 16 deletions README.md
Expand Up @@ -3,19 +3,20 @@
status](https://travis-ci.org/wlandau/learndrake.svg?branch=master)](https://travis-ci.org/wlandau/learndrake)
[![Codecov test
coverage](https://codecov.io/gh/wlandau/learndrake/branch/master/graph/badge.svg)](https://codecov.io/gh/wlandau/learndrake?branch=master)
[![Launch Rstudio
[![Launch RStudio
Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wlandau/learndrake/binder?urlpath=rstudio)

# Machine learning workflow management with drake

Machine learning workflows can be difficult to manage. A single round of
computation can take several hours to complete, and routine updates to
the code and data tend to invalidate hard-earned results. You can
enhance the maintainability, hygiene, speed, scale, and reproducibility
of such projects with the [`drake`](https://github.com/ropensci/drake) R
package. [`drake`](https://github.com/ropensci/drake) resolves the
dependency structure of your analysis pipeline, skips tasks that are
already up to date, executes the rest with [optional distributed
# Reproducible workflows at scale with `drake`

Ambitious workflows in R, such as machine learning analyses, can be
difficult to manage. A single round of computation can take several
hours to complete, and routine updates to the code and data tend to
invalidate hard-earned results. You can enhance the maintainability,
hygiene, speed, scale, and reproducibility of such projects with the
[`drake`](https://github.com/ropensci/drake) R package.
[`drake`](https://github.com/ropensci/drake) resolves the dependency
structure of your analysis pipeline, skips tasks that are already up to
date, executes the rest with [optional distributed
computing](https://ropenscilabs.github.io/drake-manual/hpc.html), and
organizes the output so you rarely have to think about data files. This
workshop will teach you how to create and maintain machine learning
Expand All @@ -38,7 +39,7 @@ keras::install_keras()

# Usage: browser

Just click this badge: [![Launch Rstudio
Just click this badge: [![Launch RStudio
Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wlandau/learndrake/binder?urlpath=rstudio).
Your browser will open the materials in a free RStudio Server instance.
The exercises are in the notebooks (`1-churn/1-churn.Rmd`,
Expand All @@ -48,15 +49,18 @@ The exercises are in the notebooks (`1-churn/1-churn.Rmd`,

The functions in `learndrake` help navigate and deploy the workshop
materials. If you installed the package and dependencies as above, you
can take the workshop locally without an internet
connection.
can take the workshop locally without an internet connection. Start with
the introductory slides, then move on to the notebooks. Launch apps
along the way as
directed.

| Function | Purpose |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `view_slides()` | Open the introductory slides in a web browser. |
| `save_notebooks()` | Save the tutorials to your computer: R notebooks and supporting files. |
| `launch_app()` | Launch a Shiny app that accompanies a tutorial. |
| `save_app()` | Save the app files so you can deploy to [shinyapps.io](https://www.shinyapps.io) or [Shiny Server](https://www.rstudio.com/products/shiny/shiny-server). |
| `save_notebooks()` | Save the tutorials to your computer: R notebooks and supporting files. |
| `save_slides()` | Save the introductory slides to your computer. |
| `view_slides()` | Open the introductory slides in a web browser. |

# Introductory slides

Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST
Expand Up @@ -6,10 +6,12 @@ github
http
https
io
Keras
learndrakeflow
learndrakeplans
Nantz
reproducibility
RStudio
shinyapps
tensorflow
wlandau
Expand Down
4 changes: 2 additions & 2 deletions man/save_app.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/save_notebooks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions man/save_slides.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/view_slides.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/testthat/test-materials.R
Expand Up @@ -2,7 +2,9 @@ context("materials")

test_that("slides", {
expect_silent(view_slides(browse = FALSE))
# view_slides() # nolint
path <- tempfile()
expect_silent(save_slides(path))
expect_true("index.Rmd" %in% list.files(path))
})

test_that("notebooks", {
Expand Down

0 comments on commit b61b42c

Please sign in to comment.