You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.qmd
+51-14Lines changed: 51 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -28,14 +28,23 @@ The following commands install the latest versions of the packages we use in thi
28
28
29
29
# Install our packages from GitHub:
30
30
pak::pkg_install("cmu-delphi/epidatr")
31
-
pak::pkg_install("cmu-delphi/epiprocess@dev")
31
+
pak::pkg_install("cmu-delphi/epiprocess")
32
32
pak::pkg_install("cmu-delphi/epipredict")
33
-
# Other data processing and example data packages we use in this book:
34
-
pak::pkg_install("tidyverse")
35
-
pak::pkg_install("modeldata")
33
+
pak::pkg_install("cmu-delphi/epidatasets")
36
34
# Other model-fitting packages we use in this book (via epipredict):
35
+
pak::pkg_install("poissonreg")
37
36
pak::pkg_install("ranger")
38
37
pak::pkg_install("xgboost")
38
+
# Other data processing, model evaluation, example data, and other packages we
39
+
# use in this book:
40
+
pak::pkg_install("RcppRoll")
41
+
pak::pkg_install("tidyverse")
42
+
pak::pkg_install("tidymodels")
43
+
pak::pkg_install("broom")
44
+
pak::pkg_install("performance")
45
+
pak::pkg_install("modeldata")
46
+
pak::pkg_install("see")
47
+
pak::pkg_install("sessioninfo")
39
48
```
40
49
41
50
Much of the data used for illustration can be loaded directly from [Delphi's Epidata API](https://cmu-delphi.github.io/delphi-epidata/) which is built and maintained by the Carnegie Mellon University [Delphi research group](https://delphi.cmu.edu/). We have tried to provide most of the data used in these examples in a separate package, `{epidatasets}`, but it can also be accessed using `{epidatr}`, an R interface to the API and the successor to [`{covidcast}`](https://cmu-delphi.github.io/covidcast/covidcastR/). These are also available from GitHub:
@@ -70,26 +79,54 @@ options(
70
79
71
80
The above commands will give you the current versions of the packages used in
72
81
this book. If you're having trouble reproducing some of the results, it may be
73
-
due to package updates that took place after the book was last updated. You can
74
-
try matching the package versions we used to build the book by one of the
75
-
following methods. You may be required to obtain a [GitHub Personal Access
and store it in the environment variable `"GITHUB_PAT"`.
82
+
due to package updates that took place after the book was last updated. To match
83
+
the versions we used to generate this book, you can use the steps below.
78
84
79
-
#### A: Download and use the `renv.lock`
85
+
#### First: set up and store a GitHub PAT
86
+
87
+
If you don't already have a GitHub PAT, you can use the following helper functions to create one:
88
+
```{r}
89
+
# Run this once:
90
+
install.packages("usethis")
91
+
usethis::create_github_token(
92
+
scopes = "public_repo",
93
+
description = "For public repo access"
94
+
)
95
+
```
96
+
This will open a web browser window allowing you to describe and customize
97
+
settings of the PAT. Scroll to the bottom and click "Generate
98
+
token". You'll see a screen that has `ghp_<lots of letters and numbers>` with a green background; you can click the two-squares ("copy") icon to copy this `ghp_......` string to the clipboard.
# If you get 401 errors, you may need to regenerate your GitHub PAT or check if
113
+
# `gitcreds::gitcreds_get()` is detecting an old PAT you have saved somewhere.
87
114
```
88
115
89
-
#### B: Download the book and use its `.Rprofile`
116
+
#### Or B: Download the book and use its `.Rprofile`
90
117
91
118
1. Download the book [here](https://github.com/cmu-delphi/delphi-tooling-book/archive/refs/heads/main.zip) and unzip it.
92
-
2. Launch R inside of the top-level directory; there should be a `.Rprofile` file there that takes care of loading the appropriate versions of all the packages used.
119
+
2. One-time setup: launch R inside the delphi-tooling-book directory (to use its
120
+
`.Rprofile` file) and run
121
+
122
+
```{r, eval = FALSE}
123
+
# Warning: don't save your GitHub PAT in a file you might share with others;
124
+
# look into `gitcreds::gitcreds_set()` or `usethis::edit_r_environ()` instead.
125
+
Sys.setenv("GITHUB_PAT" = "ghp_............")
126
+
renv::restore() # downloads the appropriate package versions
127
+
```
128
+
129
+
3. To use this set of versions: launch R inside the delphi-tooling-book directory.
title = {ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics},
59
58
author = {Hadley Wickham and Winston Chang and Lionel Henry and Thomas Lin Pedersen and Kohske Takahashi and Claus Wilke and Kara Woo and Hiroaki Yutani and Dewey Dunnington},
title = {Dates and Times Made Easy with {lubridate}},
140
-
author = {Garrett Grolemund and Hadley Wickham},
141
-
journal = {Journal of Statistical Software},
142
-
year = {2011},
143
-
volume = {40},
144
-
number = {3},
145
-
pages = {1--25},
146
-
url = {https://www.jstatsoft.org/v40/i03/},
147
-
}
148
-
149
123
@Article{tidyverse2019,
150
124
title = {Welcome to the {tidyverse}},
151
125
author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani},
0 commit comments