-
Notifications
You must be signed in to change notification settings - Fork 16
/
02-Data-basics.Rmd
99 lines (63 loc) · 1.36 KB
/
02-Data-basics.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
---
title: "Data Basics"
output: html_document
---
<!-- This file by Charlotte Wickham is licensed under a Creative Commons Attribution 4.0 International License. -->
```{r setup}
library(tidyverse)
library(haven)
library(readxl)
```
# Tabular Data
You might not see much difference between these two in this notebook, but one is a tibble and one is a data frame:
```{r}
mpg
```
```{r}
quakes
```
## Your turn 1
Take a look at these two datasets, by typing their names into the console:
* quakes
* mpg
## Your turn 2
Try running each line one by one, with Ctrl + Enter (or Cmd + Enter on Mac):
```{r}
dim(x = mpg)
names(x = mpg)
glimpse(x = mpg)
View(x = mpg)
```
## Your turn 3
How many rows of data are in quakes?
```{r}
```
What are the names of the variables in quakes?
```{r}
```
## Your turn 4
Run the chunk to get help on `mpg`. What is this data?
```{r}
?mpg
```
# Vector Data
## Your turn 5
Take another look at mpg. What kind of data is in each column?
```{r}
mpg
```
# Importing Data
## Your Turn 6
Take a look in the data/ directory in the project folder.
Try reading in each of:
* `deaths.xls`
* `nimbus.csv`
* `iris.sav`
```{r}
```
## Your Turn 7
Can you see what is wrong with the Excel file when it is imported?
Scan the Arguments section of ?read_excel, can you find an argument that might help? Try it!
```{r}
?read_excel
```