Skip to content

Commit 6fbc13f

Browse files
tech prep
1 parent 4413b79 commit 6fbc13f

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed
20.5 KB
Loading

technical-preparation.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
Workshop on `macpan2` – Technical Preparation
2+
================
3+
4+
<!-- omit from toc -->
5+
6+
# Technical Preparation for Workshop on `macpan2`
7+
8+
<!-- omit from toc -->
9+
10+
## Table of Contents
11+
12+
- [The Most Important Things](#the-most-important-things)
13+
- [Installing a Sufficiently Recent Version of
14+
R](#installing-a-sufficiently-recent-version-of-r)
15+
- [Installing Supporting R
16+
Packages](#installing-supporting-r-packages)
17+
- [Installing `macpan2`](#installing-macpan2)
18+
- [Verify that Everything Worked](#verify-that-everything-worked)
19+
20+
This document describes what you will need to do to have your computer
21+
ready for the [`macpan2`](https://canmod.github.io/macpan2/) workshop.
22+
23+
## The Most Important Things
24+
25+
If you have trouble or questions about any of the technical instructions
26+
below, please contact [Steve Walker](mailto:swalk@mcmaster.ca) (the
27+
instructor) as soon as possible so that we can focus on the material
28+
during the workshop without technical distractions.
29+
30+
Ideally you will be able to install open source software from the
31+
internet, both before and during the workshop. If this is not possible,
32+
please contact [Steve](mailto:swalk@mcmaster.ca) as soon as possible.
33+
34+
Everything we do in the workshop will involve
35+
[R](https://www.r-project.org/). If you do not use R, please email
36+
[Steve](mailto:swalk@mcmaster.ca) and briefly describe your coding
37+
background.
38+
39+
## Installing a Sufficiently Recent Version of R
40+
41+
If you are familiar with [R](https://www.r-project.org/) and have it
42+
installed, you just need to make sure that you have a sufficiently
43+
recent version. Please start R and print out the R version using the
44+
following command.
45+
46+
``` r
47+
print(R.version.string)
48+
```
49+
50+
## [1] "R version 4.4.2 (2024-10-31)"
51+
52+
This shows that I am using version R version 4.4.2 (2024-10-31). The
53+
version you get will likely be different. You need to have an R version
54+
greater than or equal to `4.1.0`. If your version is too old, please
55+
install the most recent version of R following instructions
56+
[here](https://cran.rstudio.com/).
57+
58+
If you do not have R installed already, I recommend following the
59+
installation instructions for
60+
[RStudio](https://posit.co/download/rstudio-desktop/). These
61+
instructions involve first installing [R](https://cran.rstudio.com/) and
62+
then RStudio itself, which is the program that I will use to interact
63+
with R during the workshop.
64+
65+
It is fine if you would rather use R without RStudio, but if you do not
66+
have a strong preference I recommend using RStudio.
67+
68+
## Installing Supporting R Packages
69+
70+
The [`macpan2`](https://canmod.github.io/macpan2/) package is designed
71+
to be used with a set of packages known as the
72+
[tidyverse](https://www.tidyverse.org/). To get these packages, and one
73+
more that we will also be using, please open R and issue the following
74+
command.
75+
76+
``` r
77+
install.packages(c("tidyverse", "broom.mixed"))
78+
```
79+
80+
## Installing `macpan2`
81+
82+
To install [`macpan2`](https://canmod.github.io/macpan2/) itself, please
83+
issue the following commands.
84+
85+
``` r
86+
repos = c('https://canmod.r-universe.dev', 'https://cloud.r-project.org')
87+
install.packages('macpan2', repos = repos)
88+
```
89+
90+
## Verify that Everything Worked
91+
92+
A good test of the above instructions is to copy and paste the following
93+
lines of code, and make sure that you get the same graph printed out
94+
below.
95+
96+
``` r
97+
library(macpan2); library(ggplot2); library(dplyr)
98+
```
99+
100+
##
101+
## Attaching package: 'dplyr'
102+
103+
## The following object is masked from 'package:macpan2':
104+
##
105+
## all_equal
106+
107+
## The following objects are masked from 'package:stats':
108+
##
109+
## filter, lag
110+
111+
## The following objects are masked from 'package:base':
112+
##
113+
## intersect, setdiff, setequal, union
114+
115+
``` r
116+
("starter_models"
117+
|> mp_tmb_library("sir", package = "macpan2")
118+
|> mp_simulator(time_steps = 50, outputs = "infection")
119+
|> mp_trajectory()
120+
|> mutate(incidence = value)
121+
|> ggplot()
122+
+ geom_line(aes(time, incidence))
123+
+ theme_bw()
124+
)
125+
```
126+
127+
![](technical-preparation_files/figure-gfm/sir-1.png)<!-- -->

0 commit comments

Comments
 (0)