-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.Rmd
80 lines (62 loc) · 2.6 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
knitr: bookdown::render_book
title: "Data Modeling"
author: "Sara Altman, Bill Behrman"
description: "This book is a practical introduction to modeling using the tidyverse."
url: 'https\://dcl-model.stanford.edu'
github-repo: dcl-docs/model
site: bookdown::bookdown_site
documentclass: book
bibliography: references.bib
link-citations: true
---
# Welcome {-}
## How to read this book {-}
You can easily copy the code in this book by hovering over a chunk and then clicking the copy button that appears in the upper-right corner.
Every dataset we use is contained in an R package, making it easy to follow along and replicate our examples. Many of the datasets are in our own [dcldata](https://github.com/dcl-docs/dcldata) package. To install dcldata, copy the following code and paste it into RStudio.
```{r eval=FALSE}
# You can copy this code with the copy button!
# First, install remotes if you don't already have it:
# install.packages("remotes")
remotes::install_github("dcl-docs/dcldata")
```
To access the datasets, load the relevant package
```{r message=FALSE, warning=FALSE}
library(dcldata)
```
and then call the dataset by name.
```{r}
anscombe_1
```
All datasets have accompanying documentation, which you can find with the `?` operator.
```{r eval=FALSE}
?anscombe_1
```
You can also view the names of all datasets in a given package with the `data()` function.
```{r eval=FALSE}
data(package = "dcldata")
```
In the following, we used these packages:
```{r echo=FALSE}
sessioninfo::package_info(
pkgs =
c(
"dcldata",
"ggrepel",
"knitr",
"robustbase",
"rstanarm",
"scales",
"tidymodels",
"tidyverse"
),
dependencies = FALSE
) |>
tibble::as_tibble() |>
dplyr::mutate(Source = stringr::str_remove(source, "@\\w*")) |>
dplyr::select(Package = package, Version = ondiskversion, Source) |>
knitr::kable()
```
## An evolving book {-}
This book is not intended to be static. Starting in January 2020, we use this book to teach modeling in the Stanford [Data Challenge Lab](https://datalab.stanford.edu/challenge-lab) (DCL) course. The DCL functions as a testing ground for educational materials, as our students give us routine feedback on what they read and do in the course. We use this feedback to constantly improve our materials, including this book. The [source for the book](https://github.com/dcl-docs/model) is also available on GitHub where we welcome suggestions for improvements.
This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/).