From 8efc22598b2aca2a3dabe32cb01f01703fe418a8 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Tue, 4 May 2021 08:10:39 -0500 Subject: [PATCH] Add chapter status --- _common.R | 17 +++++++++++++++++ column-wise.Rmd | 4 ++++ data-import.Rmd | 6 +++++- data-transform.Rmd | 4 ++++ import-databases.Rmd | 4 ++++ import-other.Rmd | 4 ++++ import-rectangular.Rmd | 4 ++++ import-spreadsheets.Rmd | 4 ++++ import-webscrape.Rmd | 4 ++++ list-columns.Rmd | 4 ++++ logicals-numbers.Rmd | 4 ++++ missing-values.Rmd | 4 ++++ prog-strings.Rmd | 4 ++++ regexps.Rmd | 4 ++++ strings.Rmd | 4 ++++ vector-tools.Rmd | 4 ++++ 16 files changed, 78 insertions(+), 1 deletion(-) diff --git a/_common.R b/_common.R index dad7c4d..5f2b10b 100644 --- a/_common.R +++ b/_common.R @@ -19,3 +19,20 @@ options( pillar.bold = TRUE, stringr.html = FALSE ) + + +status <- function(type) { + status <- switch(type, + restructuring = "undergoing heavy restructuring and may be confusing or incomplete", + drafting = "currently a dumping ground for ideas, and we don't recommend reading it", + stop("Invalid `type`", call. = FALSE) + ) + + cat(paste0( + "::: {.rmdnote}\n", + "You are reading the work-in-progress second edition of R for Data Science. ", + "This chapter is currently ", status, ". ", + "You can find the polished first edition at .\n", + ":::\n" + )) +} diff --git a/column-wise.Rmd b/column-wise.Rmd index 93ed769..61d912c 100644 --- a/column-wise.Rmd +++ b/column-wise.Rmd @@ -1,5 +1,9 @@ # Column-wise operations {#column-wise} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + ## Introduction diff --git a/data-import.Rmd b/data-import.Rmd index c96dddb..7955995 100644 --- a/data-import.Rmd +++ b/data-import.Rmd @@ -1,5 +1,9 @@ # Data import {#data-import} +```{r, results = "asis", echo = FALSE} +status("restructuring") +``` + ## Introduction @@ -663,4 +667,4 @@ For rectangular data: For hierarchical data: use **jsonlite** (by Jeroen Ooms) for json, and **xml2** for XML. Jenny Bryan has some excellent worked examples at . -For other file types, try the [R data import/export manual](https://cran.r-project.org/doc/manuals/r-release/R-data.html) and the [**rio**](https://github.com/leeper/rio) package. +For other file types, try the [R data import/export manual](https://cran.r-project.org/doc/manuals/r-release/R-data.html) and the [**rio**](https://github.com/leeper/rio) package. \ No newline at end of file diff --git a/data-transform.Rmd b/data-transform.Rmd index c1b1016..5f89b53 100644 --- a/data-transform.Rmd +++ b/data-transform.Rmd @@ -1,5 +1,9 @@ # Data transformation {#data-transform} +```{r, results = "asis", echo = FALSE} +status("restructuring") +``` + ## Introduction Visualisation is an important tool for insight generation, but it is rare that you get the data in exactly the right form you need. diff --git a/import-databases.Rmd b/import-databases.Rmd index eb5812d..5c3a1d3 100644 --- a/import-databases.Rmd +++ b/import-databases.Rmd @@ -1,3 +1,7 @@ # Databases {#import-databases} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + diff --git a/import-other.Rmd b/import-other.Rmd index 35e3010..ab96577 100644 --- a/import-other.Rmd +++ b/import-other.Rmd @@ -1,3 +1,7 @@ # Other types of data {#import-other} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + diff --git a/import-rectangular.Rmd b/import-rectangular.Rmd index 924215f..aacbe66 100644 --- a/import-rectangular.Rmd +++ b/import-rectangular.Rmd @@ -1,3 +1,7 @@ # Rectangular data {#import-rectangular} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + diff --git a/import-spreadsheets.Rmd b/import-spreadsheets.Rmd index d4b3d9a..0c66382 100644 --- a/import-spreadsheets.Rmd +++ b/import-spreadsheets.Rmd @@ -1,3 +1,7 @@ # Spreadsheets {#import-spreadsheets} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + diff --git a/import-webscrape.Rmd b/import-webscrape.Rmd index 74b3669..df8ea7b 100644 --- a/import-webscrape.Rmd +++ b/import-webscrape.Rmd @@ -1,3 +1,7 @@ # Web scraping {#import-webscrape} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + diff --git a/list-columns.Rmd b/list-columns.Rmd index 2aaaa57..d1dee19 100644 --- a/list-columns.Rmd +++ b/list-columns.Rmd @@ -1,5 +1,9 @@ # List columns +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + ## Introduction diff --git a/logicals-numbers.Rmd b/logicals-numbers.Rmd index 7a49976..f6f0361 100644 --- a/logicals-numbers.Rmd +++ b/logicals-numbers.Rmd @@ -1,5 +1,9 @@ # Logicals and numbers {#logicals-numbers} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + ## Introduction `between()` diff --git a/missing-values.Rmd b/missing-values.Rmd index b449169..b834b0f 100644 --- a/missing-values.Rmd +++ b/missing-values.Rmd @@ -1,5 +1,9 @@ # Missing values {#missing-values} +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + ## Introduction ```{r} diff --git a/prog-strings.Rmd b/prog-strings.Rmd index d36968b..e7174b6 100644 --- a/prog-strings.Rmd +++ b/prog-strings.Rmd @@ -1,5 +1,9 @@ # Programming with strings +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + ```{r} library(stringr) library(tidyr) diff --git a/regexps.Rmd b/regexps.Rmd index 1e32c09..d17136b 100644 --- a/regexps.Rmd +++ b/regexps.Rmd @@ -1,5 +1,9 @@ # Regular expressions +```{r, results = "asis", echo = FALSE} +status("restructuring") +``` + ## Introduction The focus of this chapter will be on regular expressions, or regexps for short. diff --git a/strings.Rmd b/strings.Rmd index 555accf..b0a5b01 100644 --- a/strings.Rmd +++ b/strings.Rmd @@ -1,5 +1,9 @@ # Strings +```{r, results = "asis", echo = FALSE} +status("restructuring") +``` + ## Introduction This chapter introduces you to strings. diff --git a/vector-tools.Rmd b/vector-tools.Rmd index 53f8973..32082c4 100644 --- a/vector-tools.Rmd +++ b/vector-tools.Rmd @@ -1,5 +1,9 @@ # Vector tools +```{r, results = "asis", echo = FALSE} +status("drafting") +``` + ## Introduction `%in%`