Skip to content

Commit ff5bb9b

Browse files
authored
Merge pull request #5 from cmu-delphi/lcb/installation-updates
Update installation instructions, dependency lists
2 parents 6f7a0b1 + 027f91d commit ff5bb9b

File tree

10 files changed

+2248
-324
lines changed

10 files changed

+2248
-324
lines changed

DESCRIPTION

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ Description:
1010
| This book is a longform introduction to analysing and forecasting epidemiological data.
1111
License: MIT + file LICENSE
1212
Imports:
13+
broom,
1314
epidatr,
1415
epidatasets,
1516
epipredict (>=0.0.5),
1617
epiprocess,
1718
modeldata,
19+
performance,
20+
poissonreg,
1821
outbreaks,
1922
ranger,
23+
RcppRoll,
24+
tidymodels,
2025
see,
2126
tidyverse,
2227
xgboost
@@ -25,6 +30,6 @@ Suggests:
2530
styler
2631
Remotes:
2732
cmu-delphi/epidatr,
33+
cmu-delphi/epiprocess,
2834
cmu-delphi/epidatasets,
29-
cmu-delphi/epiprocess@dev,
3035
cmu-delphi/epipredict

_freeze/index/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/index/figure-html/unnamed-chunk-2-1.svg

Lines changed: 395 additions & 0 deletions
Loading

_freeze/index/figure-html/unnamed-chunk-3-1.svg

Lines changed: 395 additions & 0 deletions
Loading

_freeze/index/figure-html/unnamed-chunk-5-1.svg

Lines changed: 395 additions & 0 deletions
Loading

_freeze/index/figure-html/unnamed-chunk-7-1.svg

Lines changed: 395 additions & 0 deletions
Loading

_freeze/index/figure-html/unnamed-chunk-8-1.svg

Lines changed: 394 additions & 0 deletions
Loading

index.qmd

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,23 @@ The following commands install the latest versions of the packages we use in thi
2828
2929
# Install our packages from GitHub:
3030
pak::pkg_install("cmu-delphi/epidatr")
31-
pak::pkg_install("cmu-delphi/epiprocess@dev")
31+
pak::pkg_install("cmu-delphi/epiprocess")
3232
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")
3634
# Other model-fitting packages we use in this book (via epipredict):
35+
pak::pkg_install("poissonreg")
3736
pak::pkg_install("ranger")
3837
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")
3948
```
4049

4150
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(
7079

7180
The above commands will give you the current versions of the packages used in
7281
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
76-
Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
77-
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.
7884

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.
99+
100+
#### Either A: Download and use the `renv.lock`
80101

81102
```{r, eval = FALSE}
82103
# Run this once:
83-
install.packages("renv")
104+
install.packages(c("renv", "gitcreds"))
84105
download.file("https://raw.githubusercontent.com/cmu-delphi/delphi-tooling-book/main/renv.lock", "delphi-tooling-book.renv.lock")
85-
# Run this every session you'd like to use this set of versions:
106+
107+
# Run this in a fresh session each time you'd like to use this set of versions.
108+
# Warning: don't save your GitHub PAT in a file you might share with others;
109+
# look into `gitcreds::gitcreds_set()` or `usethis::edit_r_environ()` instead.
110+
Sys.setenv("GITHUB_PAT" = "ghp_............")
86111
renv::use(lockfile = "delphi-tooling-book.renv.lock")
112+
# 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.
87114
```
88115

89-
#### B: Download the book and use its `.Rprofile`
116+
#### Or B: Download the book and use its `.Rprofile`
90117

91118
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.
93130

94131
### Other issues
95132

packages.bib

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ @Manual{R-base
33
author = {{R Core Team}},
44
organization = {R Foundation for Statistical Computing},
55
address = {Vienna, Austria},
6-
year = {2023},
6+
year = {2022},
77
url = {https://www.R-project.org/},
88
}
99

1010
@Manual{R-dplyr,
1111
title = {dplyr: A Grammar of Data Manipulation},
1212
author = {Hadley Wickham and Romain François and Lionel Henry and Kirill Müller and Davis Vaughan},
1313
year = {2023},
14-
note = {R package version 1.1.2},
15-
url = {https://CRAN.R-project.org/package=dplyr},
14+
note = {https://dplyr.tidyverse.org},
1615
}
1716

1817
@Manual{R-epidatasets,
@@ -49,80 +48,66 @@ @Manual{R-epiprocess
4948
@Manual{R-forcats,
5049
title = {forcats: Tools for Working with Categorical Variables (Factors)},
5150
author = {Hadley Wickham},
52-
year = {2023},
53-
note = {R package version 1.0.0},
51+
year = {2021},
52+
note = {R package version 0.5.1},
5453
url = {https://CRAN.R-project.org/package=forcats},
5554
}
5655

5756
@Manual{R-ggplot2,
5857
title = {ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics},
5958
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},
6059
year = {2023},
61-
note = {R package version 3.4.2},
62-
url = {https://CRAN.R-project.org/package=ggplot2},
63-
}
64-
65-
@Manual{R-lubridate,
66-
title = {lubridate: Make Dealing with Dates a Little Easier},
67-
author = {Vitalie Spinu and Garrett Grolemund and Hadley Wickham},
68-
year = {2023},
69-
note = {R package version 1.9.2},
70-
url = {https://CRAN.R-project.org/package=lubridate},
60+
note = {https://ggplot2.tidyverse.org},
7161
}
7262

7363
@Manual{R-parsnip,
7464
title = {parsnip: A Common API to Modeling and Analysis Functions},
7565
author = {Max Kuhn and Davis Vaughan},
7666
year = {2023},
77-
note = {R package version 1.1.0},
78-
url = {https://CRAN.R-project.org/package=parsnip},
67+
note = {https://github.com/tidymodels/parsnip},
7968
}
8069

8170
@Manual{R-purrr,
8271
title = {purrr: Functional Programming Tools},
8372
author = {Hadley Wickham and Lionel Henry},
8473
year = {2023},
85-
note = {R package version 1.0.1},
86-
url = {https://CRAN.R-project.org/package=purrr},
74+
note = {https://purrr.tidyverse.org/},
8775
}
8876

8977
@Manual{R-readr,
9078
title = {readr: Read Rectangular Text Data},
9179
author = {Hadley Wickham and Jim Hester and Jennifer Bryan},
92-
year = {2023},
93-
note = {R package version 2.1.4},
80+
year = {2022},
81+
note = {R package version 2.1.2},
9482
url = {https://CRAN.R-project.org/package=readr},
9583
}
9684

9785
@Manual{R-stringr,
9886
title = {stringr: Simple, Consistent Wrappers for Common String Operations},
9987
author = {Hadley Wickham},
10088
year = {2022},
101-
note = {R package version 1.5.0},
102-
url = {https://CRAN.R-project.org/package=stringr},
89+
note = {https://stringr.tidyverse.org},
10390
}
10491

10592
@Manual{R-tibble,
10693
title = {tibble: Simple Data Frames},
10794
author = {Kirill Müller and Hadley Wickham},
10895
year = {2023},
109-
note = {R package version 3.2.1},
110-
url = {https://CRAN.R-project.org/package=tibble},
96+
note = {https://tibble.tidyverse.org/},
11197
}
11298

11399
@Manual{R-tidyr,
114100
title = {tidyr: Tidy Messy Data},
115101
author = {Hadley Wickham and Davis Vaughan and Maximilian Girlich},
116102
year = {2023},
117-
note = {R package version 1.3.0},
118-
url = {https://CRAN.R-project.org/package=tidyr},
103+
note = {https://tidyr.tidyverse.org},
119104
}
120105

121106
@Manual{R-tidyverse,
122107
title = {tidyverse: Easily Install and Load the Tidyverse},
123108
author = {Hadley Wickham},
124-
year = {2023},
125-
note = {R package version 2.0.0},
109+
year = {2021},
110+
note = {R package version 1.3.1},
126111
url = {https://CRAN.R-project.org/package=tidyverse},
127112
}
128113

@@ -135,17 +120,6 @@ @Book{ggplot22016
135120
url = {https://ggplot2.tidyverse.org},
136121
}
137122

138-
@Article{lubridate2011,
139-
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-
149123
@Article{tidyverse2019,
150124
title = {Welcome to the {tidyverse}},
151125
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

Comments
 (0)