-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexploring.R
More file actions
82 lines (47 loc) · 2.86 KB
/
exploring.R
File metadata and controls
82 lines (47 loc) · 2.86 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
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
library(sjlabelled)
library(data.table)
library(magrittr)
library(Hmisc)
library(stringr)
library(ggplot2)
library(tidyverse)
library(devtools)
library(lubridate)
library(naniar)
library(readr)
library(survey)
library(haven)
# create function to make easy to read tables
fnx = function(x){print(formatC(x, format="fg", big.mark=","), quote=F)}
atusactcpsresp19 <- read_sav("C:/Users/css81/OneDrive - University of Pittsburgh/NHTS/ATUS/atusactcpsresp19.sav")
#load dataset
atus <- as_tibble(rename_all(atusactcpsresp19, tolower))
# pull min and max values
fnx(sapply(atus, max))
fnx(sapply(atus, min))
# replace null values
atus <- as_tibble(atus %>% replace_with_na(replace = list(prdisflg = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peafever = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peafnow = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peafwhn1 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peafwhn1 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peafwhn2 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peafwhn3 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peafwhn4 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pecyc = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pedisdrs = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pedisear = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pediseye = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pedisout = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pedisphy = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pedisrem = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(peeduca = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(prdasian = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pudis = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pudis1 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(pudis2 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(tewhere= c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(tudis = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(tudis1 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(tudis2 = c(-3, -2, -1))))
atus <- as_tibble(atus %>% replace_with_na(replace = list(tuecytd = c(-3, -2, -1))))