generated from intro-to-data-science-22-workshop/00-template-munzert-kermit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise_Live_Session_Lubridate.Rmd
134 lines (75 loc) · 1.79 KB
/
Exercise_Live_Session_Lubridate.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
title: "Exercise - Dates and times with Lubridate"
subtitle: "Live Session"
output:
html_document:
toc: TRUE
df_print: paged
number_sections: FALSE
highlight: tango
theme: lumen
toc_depth: 3
toc_float: true
---
```{r, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
```
## Welcome!
In this session we are going to work with **DATES** and **TIMES** with the **LUBRIDATE** package!
Why do we need a package for that?
- Dates come in different forms and shapes:
- 01.09.2022
- 01/09/22
- 09-01-2022
- SEP-09-22
- September, 09, 2022
- 09 SEP 22
- Many details for dates and time:
- Lead years
- Daylight savings time (DST)
- Time zones
- For doing calculations with dates
## Load packages for this exercise ##
```{r}
library(lubridate)
library(tidyverse)
```
## Date and time objects ##
How do we find out today's date?
```{r}
```
How can we find out the current date and time?
```{r}
```
How do we create one date and one datetime to show 12:00 pm on the 1st of August 2015?
```{r}
```
How do we tell R these are dates?
"1956 Jun 20"
```{r}
```
"14.07.2023"
```{r}
```
How do we tell R this has a date and time?
"14072003153000"
```{r}
```
## Extracting components for date and time ##
Extract the unabbreviated name of the month and the abbreviated day of the week for "14072003153000"
```{r}
```
## FIFA World Cup 2022 ##
#### First load data for the FIFA World Cup 2022 matches
Convert the date column to datetime in R in the Qatar timezone.
```{r}
```
On what date is the final match taking place?
```{r}
```
Provide a countdown to the final match from this moment (number of hours, days, etc.).
```{r}
```
At what time in Berlin will the final match take place?
```{r}
```