-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteaching-demo_live.R
50 lines (28 loc) · 910 Bytes
/
teaching-demo_live.R
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
## ------------------------------------------ ##
# Teaching Demo Actual
## ------------------------------------------ ##
## Written by Nick J Lyon
# Housekeeping --------------------------------
# Load needed libraries
library(tidyverse)
# Create a folder to save test data
dir.create("data", showWarnings = FALSE)
# Download some test data to practice manipulating it
# download.file(url = "https://ndownloader.figshare.com/files/2292169",
# destfile = file.path("data", "portal_data_joined.csv"))
# Read in the data
surveys <- read_csv(file.path("data", "portal_data_joined.csv"))
# Actual Live Coding ---------------------------
# Check structure
str(surveys)
# Look at first rows of data
head(surveys)
# First column of data
surveys[, 1]
# First row
surveys[1,]
# Specific cell
surveys[3, 10]
# Assign to a new object
surveys_v2 <- surveys[, 1:5]
# End ----