-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprep.R
More file actions
36 lines (31 loc) · 1.4 KB
/
prep.R
File metadata and controls
36 lines (31 loc) · 1.4 KB
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
# Data prep for CMT JC 2021-03-10
# S Gardiner 2021-03-01
library(tidyverse)
# PEFR -------------------------------------------------------------------------
pefr_wide <- read_table(file = "data/pefr.dct",
skip = 7,
col_names = c("Subject",
"Wright1",
"Wright2",
"Mini1",
"Mini2"))
pefr_long <- pefr_wide %>%
pivot_longer(-Subject,
names_to = c("Measure", "Run"),
names_pattern = "([a-zA-Z]+)([12])")
write_csv(pefr_wide, "data/pefr_wide.csv")
write_csv(pefr_long, "data/pefr_long.csv")
# Darbela ----------------------------------------------------------------------
darbela <- read_table(file = "data/darbela.dct",
skip = 5,
col_names = c("Subject",
"VCF short axis",
"VCF long axis"))
write_csv(darbela, "data/darbela.csv")
# Sealey -----------------------------------------------------------------------
sealey <- read_table(file = "data/sealey.dct",
skip = 4,
col_names = c("Subject",
"Pulse oximeter",
"Saturation monitor"))
write_csv(sealey, "data/sealey.csv")