Skip to content

Commit

Permalink
renamed files
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-arino committed Dec 25, 2023
1 parent b11fc75 commit 7038923
Show file tree
Hide file tree
Showing 18 changed files with 1,826 additions and 1,649 deletions.
817 changes: 0 additions & 817 deletions SLIDES/lecture-01-introduction-installation.md

This file was deleted.

817 changes: 0 additions & 817 deletions SLIDES/lecture-06-solving-ODE.md

This file was deleted.

93 changes: 93 additions & 0 deletions SLIDES/vignette-01-introduction-installation.html

Large diffs are not rendered by default.

114 changes: 114 additions & 0 deletions SLIDES/vignette-01-introduction-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
marp: true
title: Vignette 01 - Introduction to R. Installing R
description: Julien Arino - R for modellers - Vignette 01 - Introduction to R. Installing R.
theme: default
class: invert
math: mathjax
paginate: false
size: 4:3
---

<style>
.theorem {
text-align:justify;
background-color:#16a085;
border-radius:20px;
padding:10px 20px 10px 20px;
box-shadow: 0px 1px 5px #999; margin-bottom: 10px;
}
.definition {
text-align:justify;
background-color:#ededde;
border-radius:20px;
padding:10px 20px 10px 20px;
box-shadow: 0px 1px 5px #999;
margin-bottom: 10px;
}
img[alt~="center"] {
display: block;
margin: 0 auto;
}
</style>

<!-- _backgroundImage: "linear-gradient(to top, #85110d, 3%, white)" -->
# Vignette 01 - Introduction to R. Installing R

Julien Arino [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/email-round.png)](mailto:Julien.Arino@umanitoba.ca) [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/world-wide-web.png)](https://julien-arino.github.io/) [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/github-icon.png)](https://github.com/julien-arino)

Department of Mathematics & Data Science Nexus
University of Manitoba*

<div style = "font-size:18px; margin-top:-10px; padding-bottom:30px;"></div>

Canadian Centre for Disease Modelling

<div style = "text-align: justify; position: relative; bottom: -5%; font-size:18px;">
* The University of Manitoba campuses are located on original lands of Anishinaabeg, Cree, Oji-Cree, Dakota and Dene peoples, and on the homeland of the Métis Nation.</div>

---

<!-- _backgroundImage: "radial-gradient(red,30%,black)" -->
# Outline

- Foreword: the R language
- Programming in R

---

<!-- _backgroundImage: "linear-gradient(to bottom, red, black)" -->
# <!--fit-->Foreword: the R language

---

# R was originally for stats but is now much more

- Open source version of S
- Appeared in 1993
- Now (2024-01) version 4.3
- One major advantage in my view: uses a lot of C and Fortran code. E.g., `deSolve`:
> The functions provide an interface to the FORTRAN functions 'lsoda', 'lsodar', 'lsode', 'lsodes' of the 'ODEPACK' collection, to the FORTRAN functions 'dvode', 'zvode' and 'daspk' and a C-implementation of solvers of the 'Runge-Kutta' family with fixed or variable time steps
- Very active community on the web, easy to find solutions (same true of Python, I just prefer R)

---

# Development environments

- Terminal version, not very friendly
- Nicer terminal: [radian](https://github.com/randy3k/radian)
- Execute R scripts by using `Rscript name_of_script.R`. Useful to run code in `cron`, for instance
- Use IDEs:
- [RStudio](https://www.rstudio.com/products/rstudio/) has become the reference
- [RKWard](https://invent.kde.org/education/rkward) is useful if you are for instance using an ARM processor (Raspberry Pi, some Chromebooks..)
- Integrate into jupyter notebooks

---

# Going further

- [RStudio server](https://www.rstudio.com/products/rstudio/#rstudio-server): run RStudio on a Linux server and connect via a web interface
- Shiny: easily create an interactive web site running R code
- [Shiny server](https://www.rstudio.com/products/shiny/shiny-server/): run Shiny apps on a Linux server
- Rmarkdown: markdown that incorporates R commands. Useful for generating reports in html or pdf, can make slides as well..
- RSweave: LaTeX incorporating R commands. Useful for generating reports. Not used as much as Rmarkdown these days

---

# R is a scripted language

- Interactive
- Allows you to work in real time
- Be careful: what is in memory might involve steps not written down in a script
- If you want to reproduce your steps, it is good to write all the steps down in a script and to test from time to time running using `Rscript`: this will ensure that all that is required to run is indeed loaded to memory when it needs to, i.e., that it is not already there..

---

# Similar to matlab..

.. with some differences, of course! Otherwise, where would the fun be? ;)

---

<!-- _backgroundImage: "linear-gradient(to bottom, red, black)" -->
# <!--fit-->Installing `R`

58 changes: 58 additions & 0 deletions SLIDES/vignette-02-Rstudio-and-friends.html

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions SLIDES/vignette-02-Rstudio-and-friends.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
marp: true
title: Vignette 02 - RStudio and friends
description: Julien Arino - R for modellers - Vignette 02 - RStudio and friends.
theme: default
class: invert
math: mathjax
paginate: false
size: 4:3
---

<style>
.theorem {
text-align:justify;
background-color:#16a085;
border-radius:20px;
padding:10px 20px 10px 20px;
box-shadow: 0px 1px 5px #999; margin-bottom: 10px;
}
.definition {
text-align:justify;
background-color:#ededde;
border-radius:20px;
padding:10px 20px 10px 20px;
box-shadow: 0px 1px 5px #999;
margin-bottom: 10px;
}
img[alt~="center"] {
display: block;
margin: 0 auto;
}
</style>

<!-- _backgroundImage: "linear-gradient(to top, #85110d, 3%, white)" -->
# Vignette 02 - RStudio and friends

Julien Arino [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/email-round.png)](mailto:Julien.Arino@umanitoba.ca) [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/world-wide-web.png)](https://julien-arino.github.io/) [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/github-icon.png)](https://github.com/julien-arino)

Department of Mathematics
University of Manitoba*

<div style = "font-size:18px; margin-top:-10px; padding-bottom:30px;"></div>

Canadian Centre for Disease Modelling

<div style = "text-align: justify; position: relative; bottom: -5%; font-size:18px;">
* The University of Manitoba campuses are located on original lands of Anishinaabeg, Cree, Oji-Cree, Dakota and Dene peoples, and on the homeland of the Métis Nation.</div>

---

<!-- _backgroundImage: "radial-gradient(red,30%,black)" -->
# Outline

- Foreword: the R language
- Programming in R
- Dealing with data
- Solving ODE numerically

---

<!-- _backgroundImage: "linear-gradient(to bottom, red, black)" -->
# <!--fit-->Foreword: the R language

---

# Development environments

- Use IDEs:
- [RStudio](https://www.rstudio.com/products/rstudio/) has become the reference
- [RKWard](https://invent.kde.org/education/rkward) is useful if you are for instance using an ARM processor (Raspberry Pi, some Chromebooks..)
- Integrate into jupyter notebooks

---

# Going further

- [RStudio server](https://www.rstudio.com/products/rstudio/#rstudio-server): run RStudio on a Linux server and connect via a web interface
- Shiny: easily create an interactive web site running R code
- [Shiny server](https://www.rstudio.com/products/shiny/shiny-server/): run Shiny apps on a Linux server
- Rmarkdown: markdown that incorporates R commands. Useful for generating reports in html or pdf, can make slides as well..
- RSweave: LaTeX incorporating R commands. Useful for generating reports. Not used as much as Rmarkdown these days

94 changes: 94 additions & 0 deletions SLIDES/vignette-03-installing-using-packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
marp: true
title: Vignette 03 - Installing and loading packages
description: Julien Arino - R for modellers - Vignette 03 - Installing and loading packages.
theme: default
class: invert
math: mathjax
paginate: false
size: 4:3
---

<style>
.theorem {
text-align:justify;
background-color:#16a085;
border-radius:20px;
padding:10px 20px 10px 20px;
box-shadow: 0px 1px 5px #999; margin-bottom: 10px;
}
.definition {
text-align:justify;
background-color:#ededde;
border-radius:20px;
padding:10px 20px 10px 20px;
box-shadow: 0px 1px 5px #999;
margin-bottom: 10px;
}
img[alt~="center"] {
display: block;
margin: 0 auto;
}
</style>

<!-- _backgroundImage: "linear-gradient(to top, #85110d, 3%, white)" -->
# Vignette 03 - Installing and loading packages

Julien Arino [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/email-round.png)](mailto:Julien.Arino@umanitoba.ca) [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/world-wide-web.png)](https://julien-arino.github.io/) [![width:32px](https://raw.githubusercontent.com/julien-arino/presentations/main/FIGS/icons/github-icon.png)](https://github.com/julien-arino)

Department of Mathematics
University of Manitoba*

<div style = "font-size:18px; margin-top:-10px; padding-bottom:30px;"></div>

Canadian Centre for Disease Modelling

<div style = "text-align: justify; position: relative; bottom: -5%; font-size:18px;">
* The University of Manitoba campuses are located on original lands of Anishinaabeg, Cree, Oji-Cree, Dakota and Dene peoples, and on the homeland of the Métis Nation.</div>

---

# <!--fit-->Note - Required reading/watching for MATH 2740 students

If you are a student in the University of Manitoba's Mathematics of Data Science course (MATH 2740), this is **required** reading/watching

Failure to use the "user friendly" method presented later will result in loss of marks in your `R` assignments!

---

<!-- _backgroundImage: "radial-gradient(red,30%,black)" -->
# Outline

- Packages (a.k.a. libraries)
- Installing a package
- Loading a package
- Be friendly to others!

---

<!-- _backgroundImage: "linear-gradient(to bottom, #f1c40f, 20%, white)" -->
# <!--fit-->Packages (a.k.a. libraries)

---

# <!--fit-->Be friendly to others!

---

# <!--fit-->When distributing your code, think of those using it

If you are using a slightly unusual library, it is possible that a person you share your code with does not have that library installed

In this case, it is nice to them if you spare them having to do the work to install the library

But it is also possible that they already have the library

In this case, it will be annoying to them if you trigger an installation of the library (especially under linux, since there libraries are compiled for installation)

---

So the way to proceed is to test whether the library is installed

If it is, load it

If it is not, install it then load it
Loading

0 comments on commit 7038923

Please sign in to comment.