Remove status (#1527)

* Remove status

* Remove status, no other changes

* Leave a note about how to use status()

* Remove status + visual editor made some changes

* Remove backticks added by visual editor

* Remove whitespaces
This commit is contained in:
Mine Cetinkaya-Rundel 2023-07-13 11:52:21 -04:00 committed by GitHub
parent 3c75c0d2d2
commit 02651ef846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 63 additions and 97 deletions

View File

@ -1,10 +1,9 @@
# Exploratory data analysis {#sec-exploratory-data-analysis} # Exploratory data analysis {#sec-exploratory-data-analysis}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -25,6 +25,7 @@ options(
ggplot2::theme_set(ggplot2::theme_gray(12)) ggplot2::theme_set(ggplot2::theme_gray(12))
# use results: "asis" when setting a status for a chapter
status <- function(type) { status <- function(type) {
status <- switch(type, status <- switch(type,
polishing = "should be readable but is currently undergoing final polishing", polishing = "should be readable but is currently undergoing final polishing",

View File

@ -5,10 +5,9 @@ freeze: true
# Arrow {#sec-arrow} # Arrow {#sec-arrow}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# A field guide to base R {#sec-base-r} # A field guide to base R {#sec-base-r}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,8 +1,8 @@
# Communicate {#sec-communicate-intro .unnumbered} # Communicate {#sec-communicate-intro .unnumbered}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
``` ```

View File

@ -1,10 +1,9 @@
# Communication {#sec-communication} # Communication {#sec-communication}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Data import {#sec-data-import} # Data import {#sec-data-import}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Data tidying {#sec-data-tidy} # Data tidying {#sec-data-tidy}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Data transformation {#sec-data-transform} # Data transformation {#sec-data-transform}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Data visualization {#sec-data-visualization} # Data visualization {#sec-data-visualization}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,10 +1,9 @@
# Databases {#sec-import-databases} # Databases {#sec-import-databases}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction
@ -29,6 +28,7 @@ DBI is a low-level interface that connects to databases and executes SQL; dbplyr
```{r} ```{r}
#| label: setup #| label: setup
#| message: false #| message: false
library(DBI) library(DBI)
library(dbplyr) library(dbplyr)
library(tidyverse) library(tidyverse)

View File

@ -1,10 +1,9 @@
# Dates and times {#sec-dates-and-times} # Dates and times {#sec-dates-and-times}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
# https://github.com/tidyverse/lubridate/issues/1058 # https://github.com/tidyverse/lubridate/issues/1058
options(warnPartialMatchArgs = FALSE) options(warnPartialMatchArgs = FALSE)

View File

@ -1,10 +1,9 @@
# Factors {#sec-factors} # Factors {#sec-factors}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,10 +1,9 @@
# Functions {#sec-functions} # Functions {#sec-functions}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,8 +1,8 @@
# Import {#sec-import .unnumbered} # Import {#sec-import .unnumbered}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
``` ```

View File

@ -1,8 +1,8 @@
# Introduction {#sec-intro} # Introduction {#sec-intro}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
``` ```

View File

@ -1,11 +1,9 @@
# Iteration {#sec-iteration} # Iteration {#sec-iteration}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,10 +1,9 @@
# Joins {#sec-joins} # Joins {#sec-joins}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Layers {#sec-layers} # Layers {#sec-layers}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction
@ -1005,14 +1003,16 @@ There are two other coordinate systems that are occasionally helpful.
We can expand on the graphing template you learned in @sec-ggplot2-calls by adding position adjustments, stats, coordinate systems, and faceting: We can expand on the graphing template you learned in @sec-ggplot2-calls by adding position adjustments, stats, coordinate systems, and faceting:
ggplot(data = <DATA>) + ```
<GEOM_FUNCTION>( ggplot(data = <DATA>) +
mapping = aes(<MAPPINGS>), <GEOM_FUNCTION>(
stat = <STAT>, mapping = aes(<MAPPINGS>),
position = <POSITION> stat = <STAT>,
) + position = <POSITION>
<COORDINATE_FUNCTION> + ) +
<FACET_FUNCTION> <COORDINATE_FUNCTION> +
<FACET_FUNCTION>
```
Our new template takes seven parameters, the bracketed words that appear in the template. Our new template takes seven parameters, the bracketed words that appear in the template.
In practice, you rarely need to supply all seven parameters to make a graph because ggplot2 will provide useful defaults for everything except the data, the mappings, and the geom function. In practice, you rarely need to supply all seven parameters to make a graph because ggplot2 will provide useful defaults for everything except the data, the mappings, and the geom function.

View File

@ -1,11 +1,9 @@
# Logical vectors {#sec-logicals} # Logical vectors {#sec-logicals}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,10 +1,9 @@
# Missing values {#sec-missing-values} # Missing values {#sec-missing-values}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Numbers {#sec-numbers} # Numbers {#sec-numbers}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Quarto formats {#sec-quarto-formats} # Quarto formats {#sec-quarto-formats}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Quarto {#sec-quarto} # Quarto {#sec-quarto}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction
@ -118,7 +116,7 @@ This will display the report in the viewer pane as shown in @fig-diamond-sizes-r
knitr::include_graphics("quarto/diamond-sizes-report.png") knitr::include_graphics("quarto/diamond-sizes-report.png")
``` ```
When you render the document, Quarto sends the `.qmd` file to **knitr**, [https://yihui.org/knitr/](https://yihui.org/knitr/){.uri}, which executes all of the code chunks and creates a new markdown (`.md`) document which includes the code and its output. When you render the document, Quarto sends the `.qmd` file to **knitr**, <https://yihui.org/knitr/>, which executes all of the code chunks and creates a new markdown (`.md`) document which includes the code and its output.
The markdown file generated by knitr is then processed by **pandoc**, [https://pandoc.org](https://pandoc.org/){.uri}, which is responsible for creating the finished file. The markdown file generated by knitr is then processed by **pandoc**, [https://pandoc.org](https://pandoc.org/){.uri}, which is responsible for creating the finished file.
This process is shown in @fig-quarto-flow. This process is shown in @fig-quarto-flow.
The advantage of this two step workflow is that you can create a very wide range of output formats, as you'll learn about in @sec-quarto-formats. The advantage of this two step workflow is that you can create a very wide range of output formats, as you'll learn about in @sec-quarto-formats.

View File

@ -1,10 +1,9 @@
# Hierarchical data {#sec-rectangling} # Hierarchical data {#sec-rectangling}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,10 +1,9 @@
# Regular expressions {#sec-regular-expressions} # Regular expressions {#sec-regular-expressions}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Spreadsheets {#sec-import-spreadsheets} # Spreadsheets {#sec-import-spreadsheets}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Strings {#sec-strings} # Strings {#sec-strings}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,10 +1,9 @@
# Visualize {#sec-visualize .unnumbered} # Visualize {#sec-visualize .unnumbered}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
After reading the first part of the book, you understand (at least superficially) the most important tools for doing data science. After reading the first part of the book, you understand (at least superficially) the most important tools for doing data science.

View File

@ -1,10 +1,9 @@
# Web scraping {#sec-scraping} # Web scraping {#sec-scraping}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
## Introduction ## Introduction

View File

@ -1,11 +1,9 @@
# Workflow: basics {#sec-workflow-basics} # Workflow: basics {#sec-workflow-basics}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
You now have some experience running R code. You now have some experience running R code.
@ -196,8 +194,10 @@ Quotation marks and parentheses must always come in a pair.
RStudio does its best to help you, but it's still possible to mess up and end up with a mismatch. RStudio does its best to help you, but it's still possible to mess up and end up with a mismatch.
If this happens, R will show you the continuation character "+": If this happens, R will show you the continuation character "+":
> x <- "hello ```
+ > x <- "hello
+
```
The `+` tells you that R is waiting for more input; it doesn't think you're done yet. The `+` tells you that R is waiting for more input; it doesn't think you're done yet.
Usually, this means you've forgotten either a `"` or a `)`. Either add the missing pair, or press ESCAPE to abort the expression and try again. Usually, this means you've forgotten either a `"` or a `)`. Either add the missing pair, or press ESCAPE to abort the expression and try again.

View File

@ -1,11 +1,9 @@
# Workflow: getting help {#sec-workflow-getting-help} # Workflow: getting help {#sec-workflow-getting-help}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
This book is not an island; there is no single resource that will allow you to master R. This book is not an island; there is no single resource that will allow you to master R.
@ -68,11 +66,13 @@ reprex::reprex()
A nicely rendered HTML preview will display in RStudio's Viewer (if you're in RStudio) or your default browser otherwise. A nicely rendered HTML preview will display in RStudio's Viewer (if you're in RStudio) or your default browser otherwise.
The reprex is automatically copied to your clipboard (on RStudio Server or Cloud, you will need to copy this yourself): The reprex is automatically copied to your clipboard (on RStudio Server or Cloud, you will need to copy this yourself):
``` r ````
y <- 1:4 ``` r
mean(y) y <- 1:4
#> [1] 2.5 mean(y)
``` #> [1] 2.5
```
````
This text is formatted in a special way, called Markdown, which can be pasted to sites like StackOverflow or Github and they will automatically render it to look like code. This text is formatted in a special way, called Markdown, which can be pasted to sites like StackOverflow or Github and they will automatically render it to look like code.
Here's what that Markdown would look like rendered on GitHub: Here's what that Markdown would look like rendered on GitHub:

View File

@ -1,10 +1,9 @@
# Workflow: scripts and projects {#sec-workflow-scripts-projects} # Workflow: scripts and projects {#sec-workflow-scripts-projects}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
This chapter will introduce you to two essential tools for organizing your code: scripts and projects. This chapter will introduce you to two essential tools for organizing your code: scripts and projects.
@ -124,15 +123,17 @@ Three important principles for file naming are as follows:
For example, suppose you have the following files in a project folder. For example, suppose you have the following files in a project folder.
alternative model.R ```
code for exploratory analysis.r alternative model.R
finalreport.qmd code for exploratory analysis.r
FinalReport.qmd finalreport.qmd
fig 1.png FinalReport.qmd
Figure_02.png fig 1.png
model_first_try.R Figure_02.png
run-first.r model_first_try.R
temp.txt run-first.r
temp.txt
```
There are a variety of problems here: it's hard to find which file to run first, file names contain spaces, there are two files with the same name but different capitalization (`finalreport` vs. `FinalReport`[^workflow-scripts-1]), and some names don't describe their contents (`run-first` and `temp`). There are a variety of problems here: it's hard to find which file to run first, file names contain spaces, there are two files with the same name but different capitalization (`finalreport` vs. `FinalReport`[^workflow-scripts-1]), and some names don't describe their contents (`run-first` and `temp`).
@ -140,15 +141,17 @@ There are a variety of problems here: it's hard to find which file to run first,
Here's a better way of naming and organizing the same set of files: Here's a better way of naming and organizing the same set of files:
01-load-data.R ```
02-exploratory-analysis.R 01-load-data.R
03-model-approach-1.R 02-exploratory-analysis.R
04-model-approach-2.R 03-model-approach-1.R
fig-01.png 04-model-approach-2.R
fig-02.png fig-01.png
report-2022-03-20.qmd fig-02.png
report-2022-04-02.qmd report-2022-03-20.qmd
report-draft-notes.txt report-2022-04-02.qmd
report-draft-notes.txt
```
Numbering the key scripts make it obvious in which order to run them and a consistent naming scheme makes it easier to see what varies. Numbering the key scripts make it obvious in which order to run them and a consistent naming scheme makes it easier to see what varies.
Additionally, the figures are labelled similarly, the reports are distinguished by dates included in the file names, and `temp` is renamed to `report-draft-notes` to better describe its contents. Additionally, the figures are labelled similarly, the reports are distinguished by dates included in the file names, and `temp` is renamed to `report-draft-notes` to better describe its contents.

View File

@ -1,11 +1,9 @@
# Workflow: code style {#sec-workflow-style} # Workflow: code style {#sec-workflow-style}
```{r} ```{r}
#| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("complete")
``` ```
Good coding style is like correct punctuation: you can manage without it, butitsuremakesthingseasiertoread. Good coding style is like correct punctuation: you can manage without it, butitsuremakesthingseasiertoread.