Hands-on Introduction to R 2023
Summary
- Lecturer: Watal M Iwasaki, PhD
- Date: 2023-11-27 to 2023-12-06
- Time: 16:00+JST, 90 minutes a day
- Place: Zoom.us + Biology bldg., Aobayama, Tohoku University
- Website: https://heavywatal.github.io/slides/english2023r/
Links to the slides are at the bottom: - Abstract:
Biological research is, roughly speaking, to collect data from organisms and decipher the rule behind them. Data analysis and visualization are therefore essential skills for any researcher in this field. But don’t even think about manual works in Excel because they are cumbersome, error-prone, and above all, unreproducible. Let machines do repetitive and boring tasks. Here, we learn how to use R language/environment effectively to prepare and analyze data. - Prerequisite
- Basic computer skills: browsing webpages, handling files and folders, etc.
- Preparation of computing environment (described later)
- Textbook
- None
- References
Preparation
- Apply all the software updates available and restart the OS:
- Windows 11 (≥22H2)
- macOS Ventura (≥13.6)
- Configure OS to always show file extensions (suffixes of file names such as
.pdf
and.png
) - Download the latest R (≥4.3.2) from https://cran.r-project.org/.
Install it with the default settings by pressing OK/Proceed.
If you have old versions installed, remove them before new installation just in case.
- Windows → base →
R-4.*.*-win.exe
- Mac
→
R-4.*.*-arm64.pkg
(Apple Silicon) orR-4.*.*.pkg
(Intel)
- Windows → base →
- Download the latest RStudio (≥2023.09.0) from https://posit.co/download/rstudio-desktop/ and install it. If you have old versions installed, remove them before new installation just in case.
- Install developer tools.
They are not required here, but you will need them eventually.
- Windows: Rtools (select the version corresponding to the R you installed)
- Mac: Command Line Tools:
Execute
xcode-select --install
on Terminal.app. Xcode itself is not necessary unless you want to develop iPhone apps.
- Launch RStudio, and execute the following line on the left panel called “Console”:
Answer
install.packages("tidyverse", type = "binary")
yes
if necessary. Many packages will be installed. If some errors or warnings come up, copy them to a text file to show me later. - Execute the following two lines on Console, and check the message:
library(conflicted) library(tidyverse)
── Attaching core tidyverse packages ───────────────── tidyverse 2.0.0 ── ✔ dplyr 1.1.4 ✔ readr 2.1.4 ✔ forcats 1.0.0 ✔ stringr 1.5.1 ✔ ggplot2 3.4.4 ✔ tibble 3.2.1 ✔ lubridate 1.9.3 ✔ tidyr 1.3.0 ✔ purrr 1.0.2
Slides
←→ keys to go back and forth.
- 2023-11-27 16:00 | Introduction: what is data analysis and R basics
- 2023-11-28 16:00 | Data visualization and reporting
- 2023-11-29 16:00 | Data transformation 1: extract, summarize
- 2023-11-30 16:00 | Data transformation 2: join, pivot
- 2023-12-01 16:00 | Data cleansing and conversion: numbers, text
- 2023-12-04 16:00 | Data input and interpretation
- 2023-12-05 16:00 | Statistical modeling 1: probability distribution, likelihood
- 2023-12-06 16:00 | Statistical modeling 2: linear regression