Section 1: Transportation
Q1:How many bicycles are kept in your household?
Adult bikes
ggplot(d, aes(x = d$Q1_transp_bikes_adults)) + geom_bar(na.rm = TRUE) + xlab("Number of bicycles for adults")

summary(d$Q1_transp_bikes_adults)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.000 2.000 3.000 3.294 4.000 20.000
Children bikes
ggplot(d, aes(x = d$Q1_transp_bikes_children)) + geom_bar(na.rm = TRUE) + xlab("Number of bicycles for children") + scale_x_continuous()

summary(d$Q1_transp_bikes_children)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0000 0.0000 0.0000 0.6538 1.0000 10.0000
Q2:On a scale of 1 to 5, with 1 being ‘very safe’ and 5 being ‘very dangerous’, overall, how safe do you think cycling is in your city?
t1 <- prop.table(table(factor(d$Q2_bike_safety, levels = 1:5)))*100
t1 <- as.data.frame(t1)
t1$group <- substring(row.names(t1), 1)
t1$group <- revalue(as.character(t1$group), c("1" = "Very safe", "2" = "Somewhat safe", "3" = "Neither safe nor unsafe", "4" = "Somewhat dangerous", "5" = "Very dangerous"))
t1$plot <- factor(t1$group, t1$group)
p <- ggplot(t1, aes(x=group, y=Freq, fill=group)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t1
p + geom_bar(aes(x = plot), data = t1, stat = "identity", colour="black") +
scale_fill_brewer(palette = "YlGn", direction=1) +
guides(fill=FALSE)+
ylab("Percent of total") +
xlab("Perception of bicycle risk") +
ggtitle("Overall, how safe do you think cycling is in your city?")

t1.tb <- as.factor(d$Q2_bike_safety)
t1.tb <- summary(t1.tb)
t1.tb <- as.data.frame(t1.tb)
t1.tb$Var1 <- substring(row.names(t1.tb), 1)
t1.tb$group <- revalue(as.character(t1.tb$Var1), c("1" = "Very safe", "2" = "Somewhat safe", "3" = "Neither safe nor unsafe", "4" = "Somewhat dangerous", "5" = "Very dangerous"))
plot.t1 <- merge(t1, t1.tb, by = "group")
plot.t1 <- plot.t1[-c(2, 4, 6)]
plot.t1 <- setcolorder(plot.t1, c("group", "t1.tb", "Freq"))
plot.t1$order <- c(3, 4, 2, 5, 1)
plot.t1 <- plot.t1 %>% arrange(order)
plot.t1 <- plot.t1[-c(4)]
colnames(plot.t1) <- c("Response", "N", "Proportion")
kable(plot.t1)
Very safe |
23 |
8.041958 |
Somewhat safe |
168 |
58.741259 |
Neither safe nor unsafe |
34 |
11.888112 |
Somewhat dangerous |
56 |
19.580420 |
Very dangerous |
5 |
1.748252 |
Q3: How often do you typically travel by bicycle during each season?
fall
t2 <- prop.table(table(factor(d$Q3_freq_fall, levels = 0:7)))*100
t2 <- as.data.frame(t2)
t2$days <- substring(row.names(t2), 1)
t2$days <- revalue(as.character(t2$days), c("1" = "0", "2" = "1", "3" = "2", "4" = "3", "5" = "4", "6" = "5", "7" = "6", "8" = "7"))
t2$plot <- factor(t2$days, t2$days)
p2 <- ggplot(t2, aes(x = days, y = Freq, fill = days)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t2
p2 + geom_bar(aes(x = plot), data = t2, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn") +
ylab("Percent of total") +
xlab("Bicycling number of days per week") +
ggtitle("How often do you typically travel by bicycle during the fall?")

summary(d$Q3_freq_fall)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 3.250 5.000 4.629 6.000 7.000
winter
t3 <- prop.table(table(factor(d$Q3_freq_winter, levels = 0:7)))*100
t3 <- as.data.frame(t3)
t3$days <- substring(row.names(t3), 1)
t3$days <- revalue(as.character(t3$days), c("1" = "0", "2" = "1", "3" = "2", "4" = "3", "5" = "4", "6" = "5", "7" = "6", "8" = "7"))
t3$plot <- factor(t3$days, t3$days)
p3 <- ggplot(t3, aes(x = days, y = Freq, fill = days)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t3
p3 + geom_bar(aes(x = plot), data = t3, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("Bicycling number of days per week") +
ggtitle("How often do you typically travel by bicycle during the winter?")

summary(d$Q3_freq_winter)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 2.000 4.000 3.675 5.000 7.000
spring
t4 <- prop.table(table(factor(d$Q3_freq_spring, levels = 0:7)))*100
t4 <- as.data.frame(t4)
t4$days <- substring(row.names(t4), 1)
t4$days <- revalue(as.character(t4$days), c("1" = "0", "2" = "1", "3" = "2", "4" = "3", "5" = "4", "6" = "5", "7" = "6", "8" = "7"))
t4$plot <- factor(t4$days, t4$days)
p4 <- ggplot(t4, aes(x = days, y = Freq, fill = days)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t4
p4 + geom_bar(aes(x = plot), data = t4, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("Bicycling number of days per week") +
ggtitle("How often do you typically travel by bicycle during the winter?")

summary(d$Q3_freq_spring)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 4.000 5.000 4.825 6.000 7.000
summer
t5 <- prop.table(table(factor(d$Q3_freq_summer, levels = 0:7)))*100
t5 <- as.data.frame(t5)
t5$days <- substring(row.names(t5), 1)
t5$days <- revalue(as.character(t5$days), c("1" = "0", "2" = "1", "3" = "2", "4" = "3", "5" = "4", "6" = "5", "7" = "6", "8" = "7"))
t5$plot <- factor(t5$days, t5$days)
p4 <- ggplot(t5, aes(x = days, y = Freq, fill = days)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
p4 + geom_bar(aes(x = plot), data = t5, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("Bicycling number of days per week") +
ggtitle("How often do you typically travel by bicycle during the winter?")

summary(d$Q3_freq_summer)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 5.000 5.000 5.217 6.000 7.000
Q4: How often are your cycling trips made with children?
bike.ch <- prop.table(table(factor(d$Q4_bike_children, levels = 1:4)))*100
bike.ch <- as.data.frame(bike.ch)
bike.ch$group <- substring(row.names(bike.ch), 1)
bike.ch$group <- revalue(as.character(bike.ch$group), c("1" = "Never", "2" = "Sometimes", "3" = "Often", "4" = "Always"))
bike.ch$plot <- factor(bike.ch$group, bike.ch$group)
ch <- ggplot(bike.ch, aes(x = group, y = Freq, fill = group)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey")
ch + geom_bar(aes(x = plot), data = bike.ch, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Bicyle trips with children") +
ggtitle("How often are your cycling trips made with children?")

trips.ch <- as.factor(d$Q4_bike_children)
trips.ch <- summary(trips.ch)
trips.ch <- as.data.frame(trips.ch)
trips.ch$Var1 <- substring(row.names(trips.ch), 1)
trips.ch$group <- revalue(as.character(trips.ch$Var1), c("1" = "Never", "2" = "Sometimes", "3" = "Often", "4" = "Always"))
plot.ch <- merge(bike.ch, trips.ch, by = "group")
plot.ch <- plot.ch[-c(1:2, 6)]
plot.ch <- setcolorder(plot.ch, c("plot", "trips.ch", "Freq"))
plot.ch$order <- c(4, 1, 3, 2)
plot.ch <- plot.ch %>% arrange(order)
plot.ch <- plot.ch[-c(4)]
colnames(plot.ch) <- c("Response", "N", "Proportion")
kable(plot.ch)
Never |
199 |
69.580420 |
Sometimes |
53 |
18.531468 |
Often |
29 |
10.139860 |
Always |
5 |
1.748252 |
Q5: Do you currently use any of the following roads when you bike in Victoria?
Cook St or Fifth St
cook <- prop.table(table(factor(d$Q5_vicroads_a, levels = c("1", "2", "77"))))*100
cook <- as.data.frame(cook)
cook$answer <- substring(row.names(cook), 1)
cook$answer <- revalue(as.character(cook$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
cook$plot <- factor(cook$answer, cook$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
cook.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
cook.plot + geom_bar(aes(x = plot), data = cook, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

cook.tb <- as.factor(d$Q5_vicroads_a)
cook.tb <- summary(cook.tb)
cook.tb <- as.data.frame(cook.tb)
cook.tb$Var1 <- substring(row.names(cook.tb), 1)
cook.tb$answer <- revalue(as.character(cook.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.cook <- merge(cook, cook.tb, by = "answer")
plot.cook <- plot.cook[-c(2, 4, 6)]
plot.cook <- setcolorder(plot.cook, c("answer", "cook.tb", "Freq"))
plot.cook$order <- c(3, 2, 1)
plot.cook <- plot.cook %>% arrange(order)
plot.cook <- plot.cook[-c(4)]
colnames(plot.cook) <- c("Response", "N", "Proportion")
kable(plot.cook)
Yes |
182 |
63.636364 |
No |
101 |
35.314685 |
Don’t know |
3 |
1.048951 |
Fairfield Rd or Humboldt St
ffield <- prop.table(table(factor(d$Q5_vicroads_b, levels = c("1", "2", "77"))))*100
ffield <- as.data.frame(ffield)
ffield$answer <- substring(row.names(ffield), 1)
ffield$answer <- revalue(as.character(ffield$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
ffield$plot <- factor(ffield$answer, ffield$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
ffield.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
ffield.plot + geom_bar(aes(x = plot), data = ffield, stat = "identity", colour="black")

ffield.tb <- as.factor(d$Q5_vicroads_b)
ffield.tb <- summary(ffield.tb)
ffield.tb <- as.data.frame(ffield.tb)
ffield.tb$Var1 <- substring(row.names(ffield.tb), 1)
ffield.tb$answer <- revalue(as.character(ffield.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.ffield <- merge(ffield, ffield.tb, by = "answer")
plot.ffield <- plot.ffield[-c(2, 4, 6)]
plot.ffield <- setcolorder(plot.ffield, c("answer", "ffield.tb", "Freq"))
plot.ffield$order <- c(3, 2, 1)
plot.ffield <- plot.ffield %>% arrange(order)
plot.ffield <- plot.ffield[-c(4)]
colnames(plot.ffield) <- c("Response", "N", "Proportion")
kable(plot.ffield)
Yes |
143 |
50.000000 |
No |
140 |
48.951049 |
Don’t know |
3 |
1.048951 |
Fort St
fort <- prop.table(table(factor(d$Q5_vicroads_c, levels = c("1", "2", "77"))))*100
fort <- as.data.frame(fort)
fort$answer <- substring(row.names(fort), 1)
fort$answer <- revalue(as.character(fort$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
fort$plot <- factor(fort$answer, fort$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
fort.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
fort.plot + geom_bar(aes(x = plot), data = fort, stat = "identity", colour="black")

fort.tb <- as.factor(d$Q5_vicroads_c)
fort.tb <- summary(fort.tb)
fort.tb <- as.data.frame(fort.tb)
fort.tb$Var1 <- substring(row.names(fort.tb), 1)
fort.tb$answer <- revalue(as.character(fort.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.fort <- merge(fort, fort.tb, by = "answer")
plot.fort <- plot.fort[-c(2, 4, 6)]
plot.fort <- setcolorder(plot.fort, c("answer", "fort.tb", "Freq"))
plot.fort$order <- c(3, 2, 1)
plot.fort <- plot.fort %>% arrange(order)
plot.fort <- plot.fort[-c(4)]
colnames(plot.fort) <- c("Response", "N", "Proportion")
kable(plot.fort)
Yes |
221 |
77.2727273 |
No |
64 |
22.3776224 |
Don’t know |
1 |
0.3496503 |
###Government |
St |
|
gvt <- prop.table(table(factor(d$Q5_vicroads_d, levels = c("1", "2", "77"))))*100
gvt <- as.data.frame(gvt)
gvt$answer <- substring(row.names(gvt), 1)
gvt$answer <- revalue(as.character(gvt$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
gvt$plot <- factor(gvt$answer, gvt$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
gvt.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
gvt.plot + geom_bar(aes(x = plot), data = gvt, stat = "identity", colour="black")

gvt.tb <- as.factor(d$Q5_vicroads_d)
gvt.tb <- summary(gvt.tb)
gvt.tb <- as.data.frame(gvt.tb)
gvt.tb$Var1 <- substring(row.names(gvt.tb), 1)
gvt.tb$answer <- revalue(as.character(gvt.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.gvt <- merge(gvt, gvt.tb, by = "answer")
plot.gvt <- plot.gvt[-c(2, 4, 6)]
plot.gvt <- setcolorder(plot.gvt, c("answer", "gvt.tb", "Freq"))
plot.gvt$order <- c(3, 2, 1)
plot.gvt <- plot.gvt %>% arrange(order)
plot.gvt <- plot.gvt[-c(4)]
colnames(plot.gvt) <- c("Response", "N", "Proportion")
kable(plot.gvt)
Yes |
216 |
75.5244755 |
No |
69 |
24.1258741 |
Don’t know |
1 |
0.3496503 |
Haultain St or Kings Rd
haultain <- prop.table(table(factor(d$Q5_vicroads_e, levels = c("1", "2", "77"))))*100
haultain <- as.data.frame(haultain)
haultain$answer <- substring(row.names(haultain), 1)
haultain$answer <- revalue(as.character(haultain$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
haultain$plot <- factor(haultain$answer, haultain$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
haultain.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
haultain.plot + geom_bar(aes(x = plot), data = haultain, stat = "identity", colour="black")

haultain.tb <- as.factor(d$Q5_vicroads_e)
haultain.tb <- summary(haultain.tb)
haultain.tb <- as.data.frame(haultain.tb)
haultain.tb$Var1 <- substring(row.names(haultain.tb), 1)
haultain.tb$answer <- revalue(as.character(haultain.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.haultain <- merge(haultain, haultain.tb, by = "answer")
plot.haultain <- plot.haultain[-c(2, 4, 6)]
plot.haultain <- setcolorder(plot.haultain, c("answer", "haultain.tb", "Freq"))
plot.haultain$order <- c(3, 2, 1)
plot.haultain <- plot.haultain %>% arrange(order)
plot.haultain <- plot.haultain[-c(4)]
colnames(plot.haultain) <- c("Response", "N", "Proportion")
kable(plot.haultain)
Yes |
165 |
57.692308 |
No |
115 |
40.209790 |
Don’t know |
6 |
2.097902 |
Pandora Ave
pand <- prop.table(table(factor(d$Q5_vicroads_f, levels = c("1", "2", "77"))))*100
pand <- as.data.frame(pand)
pand$answer <- substring(row.names(pand), 1)
pand$answer <- revalue(as.character(pand$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
pand$plot <- factor(pand$answer, pand$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
pand.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
pand.plot + geom_bar(aes(x = plot), data = pand, stat = "identity", colour="black")

pand.tb <- as.factor(d$Q5_vicroads_f)
pand.tb <- summary(pand.tb)
pand.tb <- as.data.frame(pand.tb)
pand.tb$Var1 <- substring(row.names(pand.tb), 1)
pand.tb$answer <- revalue(as.character(pand.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.pand <- merge(pand, pand.tb, by = "answer")
plot.pand <- plot.pand[-c(2, 4, 6)]
plot.pand <- setcolorder(plot.pand, c("answer", "pand.tb", "Freq"))
plot.pand$order <- c(3, 2, 1)
plot.pand <- plot.pand %>% arrange(order)
plot.pand <- plot.pand[-c(4)]
colnames(plot.pand) <- c("Response", "N", "Proportion")
kable(plot.pand)
Yes |
245 |
85.6643357 |
No |
40 |
13.9860140 |
Don’t know |
1 |
0.3496503 |
Shelbourne St or Begbie St
shelb <- prop.table(table(factor(d$Q5_vicroads_g, levels = c("1", "2", "77"))))*100
shelb <- as.data.frame(shelb)
shelb$answer <- substring(row.names(shelb), 1)
shelb$answer <- revalue(as.character(shelb$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
shelb$plot <- factor(shelb$answer, shelb$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
shelb.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
shelb.plot + geom_bar(aes(x = plot), data = shelb, stat = "identity", colour="black")

shelb.tb <- as.factor(d$Q5_vicroads_g)
shelb.tb <- summary(shelb.tb)
shelb.tb <- as.data.frame(shelb.tb)
shelb.tb$Var1 <- substring(row.names(shelb.tb), 1)
shelb.tb$answer <- revalue(as.character(shelb.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.shelb <- merge(shelb, shelb.tb, by = "answer")
plot.shelb <- plot.shelb[-c(2, 4, 6)]
plot.shelb <- setcolorder(plot.shelb, c("answer", "shelb.tb", "Freq"))
plot.shelb$order <- c(3, 2, 1)
plot.shelb <- plot.shelb %>% arrange(order)
plot.shelb <- plot.shelb[-c(4)]
colnames(plot.shelb) <- c("Response", "N", "Proportion")
kable(plot.shelb)
Yes |
117 |
40.909091 |
No |
166 |
58.041958 |
Don’t know |
3 |
1.048951 |
Harbour Rd, Wharf St or Belville St
bellv <- prop.table(table(factor(d$Q5_vicroads_h, levels = c("1", "2", "77"))))*100
bellv <- as.data.frame(bellv)
bellv$answer <- substring(row.names(bellv), 1)
bellv$answer <- revalue(as.character(bellv$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
bellv$plot <- factor(bellv$answer, bellv$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
bellv.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
bellv.plot + geom_bar(aes(x = plot), data = bellv, stat = "identity", colour="black")

bellv.tb <- as.factor(d$Q5_vicroads_h)
bellv.tb <- summary(bellv.tb)
bellv.tb <- as.data.frame(bellv.tb)
bellv.tb$Var1 <- substring(row.names(bellv.tb), 1)
bellv.tb$answer <- revalue(as.character(bellv.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.bellv <- merge(bellv, bellv.tb, by = "answer")
plot.bellv <- plot.bellv[-c(2, 4, 6)]
plot.bellv <- setcolorder(plot.bellv, c("answer", "bellv.tb", "Freq"))
plot.bellv$order <- c(3, 2, 1)
plot.bellv <- plot.bellv %>% arrange(order)
plot.bellv <- plot.bellv[-c(4)]
colnames(plot.bellv) <- c("Response", "N", "Proportion")
kable(plot.bellv)
Yes |
224 |
78.321678 |
No |
59 |
20.629371 |
Don’t know |
3 |
1.048951 |
Galloping Goose or the E&N Trail
goose <- prop.table(table(factor(d$Q5_vicroads_i, levels = c("1", "2", "77"), exclude = NULL)))*100
goose <- as.data.frame(goose)
goose$answer <- substring(row.names(goose), 1)
goose$answer <- revalue(as.character(goose$answer), c("1" = "Yes", "2" = "No", "3" = "Don't know"))
goose$plot <- factor(goose$answer, goose$answer)
cols <- c("#31a354","#f03b20","grey","grey") #get colors for plot
goose.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
goose.plot + geom_bar(aes(x = plot), data = goose, stat = "identity", colour="black")

goose.tb <- as.factor(d$Q5_vicroads_i)
goose.tb <- summary(goose.tb)
goose.tb <- as.data.frame(goose.tb)
goose.tb$Var1 <- substring(row.names(goose.tb), 1)
goose.tb$answer <- revalue(as.character(goose.tb$Var1), c("1" = "Yes", "2" = "No", "77" = "Don't know"))
plot.goose <- merge(goose, goose.tb, by = "answer")
plot.goose <- plot.goose[-c(2, 4, 6)]
plot.goose <- setcolorder(plot.goose, c("answer", "goose.tb", "Freq"))
plot.goose$order <- c(3, 2, 1)
plot.goose <- plot.goose %>% arrange(order)
plot.goose <- plot.goose[-c(4)]
colnames(plot.goose) <- c("Response", "N", "Proportion")
kable(plot.goose)
Yes |
251 |
87.7622378 |
No |
34 |
11.8881119 |
Don’t know |
1 |
0.3496503 |
Q6: How much would you agree with the following statement: “I would like to travel by bicycle more than I do now”?
bike.more <- prop.table(table(factor(d$Q6_bike_more, levels = c("1", "2", "3", "4", "77"))))*100
bike.more <- as.data.frame(bike.more)
bike.more$group <- substring(row.names(bike.more), 1)
bike.more$group <- revalue(as.character(bike.more$group), c("1" = "Strongly agree", "2" = "Somewhat agree", "3" = "Somewhat disagree", "4" = "Strongly disagree", "5" = "Don't know"))
bike.more$plot <- factor(bike.more$group, bike.more$group)
ch <- ggplot(bike.more, aes(x = group, y = Freq, fill = group)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
ch + geom_bar(aes(x = plot), data = bike.more, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn", direction=-1) +
ylab("Percent of total") +
xlab("Bicyle more") +
ggtitle("I would like to travel by bicycle more than I do now")

more.tb <- as.factor(d$Q6_bike_more)
more.tb <- summary(more.tb)
more.tb <- as.data.frame(more.tb)
more.tb$Var1 <- substring(row.names(more.tb), 1)
more.tb$group <- revalue(as.character(more.tb$Var1), c("1" = "Strongly agree", "2" = "Somewhat agree", "3" = "Somewhat disagree", "4" = "Strongly disagree", "77" = "Don't know"))
more.plot <- merge(bike.more, more.tb, by = "group")
more.plot <- more.plot[-c(1:2, 6)]
more.plot <- setcolorder(more.plot, c("plot", "more.tb", "Freq"))
more.plot$order <- c(5, 2, 3, 1, 4)
more.plot <- more.plot %>% arrange(order)
more.plot <- more.plot[-c(4)]
colnames(more.plot) <- c("Response", "N", "Proportion")
kable(more.plot)
Strongly agree |
111 |
38.811189 |
Somewhat agree |
126 |
44.055944 |
Somewhat disagree |
24 |
8.391608 |
Strongly disagree |
17 |
5.944056 |
Don’t know |
8 |
2.797203 |
Q7: How comfortable would you feel biking in the following places?
A path or trail that is physically separate from the street
path <- prop.table(table(factor(d$Q7_bike_comf_a, levels = c("1", "2", "3", "4", "77"))))*100
path <- as.data.frame(path)
path$answer <- substring(row.names(path), 1)
path$answer <- revalue(as.character(path$answer), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
path$plot <- factor(path$answer, path$answer)
path.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
path.plot + geom_bar(aes(x = plot), data = path, stat = "identity", colour="black")

path.tb <- as.factor(d$Q7_bike_comf_a)
path.tb <- summary(path.tb)
path.tb <- as.data.frame(path.tb)
path.tb$Var1 <- substring(row.names(path.tb), 1)
nval.df <- c("0", "0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$path.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("2", "5")
nval.df <- nval.df[-c(1)]
path.tb <- rbind(path.tb, nval.df)
path.tb$answer <- revalue(as.character(path.tb$Var1), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
plot.path <- merge(path, path.tb, by = "answer")
plot.path <- plot.path[-c(2, 4, 6)]
plot.path <- setcolorder(plot.path, c("answer", "path.tb", "Freq"))
plot.path$order <- c(5, 3, 2, 4, 1)
plot.path <- plot.path %>% arrange(order)
plot.path <- plot.path[-c(4)]
colnames(plot.path) <- c("Response", "N", "Proportion")
kable(plot.path)
Very uncomfortable |
22 |
7.692308 |
Somewhat uncomfortable |
0 |
0.000000 |
Somewhat comfortable |
18 |
6.293706 |
Very comfortable |
246 |
86.013986 |
Don’t know |
0 |
0.000000 |
A quiet, residential street with traffic speeds of 30-40 km per hour
res <- prop.table(table(factor(d$Q7_bike_comf_b, levels = c("1", "2", "3", "4", "77"))))*100
res <- as.data.frame(res)
res$answer <- substring(row.names(res), 1)
res$answer <- revalue(as.character(res$answer), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
res$plot <- factor(res$answer, res$answer)
res.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
res.plot + geom_bar(aes(x = plot), data = res, stat = "identity", colour="black")

res.tb <- as.factor(d$Q7_bike_comf_b)
res.tb <- summary(res.tb)
res.tb <- as.data.frame(res.tb)
res.tb$Var1 <- substring(row.names(res.tb), 1)
nval.df <- c("0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$res.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c( "5")
nval.df <- nval.df[-c(1)]
res.tb <- rbind(res.tb, nval.df)
res.tb$answer <- revalue(as.character(res.tb$Var1), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
plot.res <- merge(res, res.tb, by = "answer")
plot.res <- plot.res[-c(2, 4, 6)]
plot.res <- setcolorder(plot.res, c("answer", "res.tb", "Freq"))
plot.res$order <- c(5, 3, 2, 4, 1)
plot.res <- plot.res %>% arrange(order)
plot.res <- plot.res[-c(4)]
colnames(plot.res) <- c("Response", "N", "Proportion")
kable(plot.res)
Very uncomfortable |
22 |
7.692308 |
Somewhat uncomfortable |
20 |
6.993007 |
Somewhat comfortable |
89 |
31.118881 |
Very comfortable |
155 |
54.195804 |
Don’t know |
0 |
0.000000 |
A quiet residential street, with a 30 km per hour speed limit, bicycle route markings, wide speed bumps, and other things that slow down and discourage car traffic
bkwy <- prop.table(table(factor(d$Q7_bike_comf_c, levels = c("1", "2", "3", "4", "77"))))*100
bkwy <- as.data.frame(bkwy)
bkwy$answer <- substring(row.names(bkwy), 1)
bkwy$answer <- revalue(as.character(bkwy$answer), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
bkwy$plot <- factor(bkwy$answer, bkwy$answer)
bkwy.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
bkwy.plot + geom_bar(aes(x = plot), data = bkwy, stat = "identity", colour="black")

bkwy.tb <- as.factor(d$Q7_bike_comf_c)
bkwy.tb <- summary(bkwy.tb)
bkwy.tb <- as.data.frame(bkwy.tb)
bkwy.tb$Var1 <- substring(row.names(bkwy.tb), 1)
bkwy.tb$answer <- revalue(as.character(bkwy.tb$Var1), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "77" = "Don't know"))
plot.bkwy <- merge(bkwy, bkwy.tb, by = "answer")
plot.bkwy <- plot.bkwy[-c(2, 4, 6)]
plot.bkwy <- setcolorder(plot.bkwy, c("answer", "bkwy.tb", "Freq"))
plot.bkwy$order <- c(5, 3, 2, 4, 1)
plot.bkwy <- plot.bkwy %>% arrange(order)
plot.bkwy <- plot.bkwy[-c(4)]
colnames(plot.bkwy) <- c("Response", "N", "Proportion")
kable(plot.bkwy)
Very uncomfortable |
23 |
8.0419580 |
Somewhat uncomfortable |
4 |
1.3986014 |
Somewhat comfortable |
42 |
14.6853147 |
Very comfortable |
216 |
75.5244755 |
Don’t know |
1 |
0.3496503 |
A major urban or suburban street with four lanes, on-street parking, traffic speeds of 50-60 km per hour, and no bike lane
major <- prop.table(table(factor(d$Q7_bike_comf_d, levels = c("1", "2", "3", "4", "77"))))*100
major <- as.data.frame(major)
major$answer <- substring(row.names(major), 1)
major$answer <- revalue(as.character(major$answer), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
major$plot <- factor(major$answer, major$answer)
major.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
major.plot + geom_bar(aes(x = plot), data = major, stat = "identity", colour="black")

major.tb <- as.factor(d$Q7_bike_comf_d)
major.tb <- summary(major.tb)
major.tb <- as.data.frame(major.tb)
major.tb$Var1 <- substring(row.names(major.tb), 1)
nval.df <- c("0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$major.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c( "77")
nval.df <- nval.df[-c(1)]
major.tb <- rbind(major.tb, nval.df)
major.tb$answer <- revalue(as.character(major.tb$Var1), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "77" = "Don't know"))
plot.major <- merge(major, major.tb, by = "answer")
plot.major <- plot.major[-c(2, 4, 6)]
plot.major <- setcolorder(plot.major, c("answer", "major.tb", "Freq"))
plot.major$order <- c(5, 3, 2, 4, 1)
plot.major <- plot.major %>% arrange(order)
plot.major <- plot.major[-c(4)]
colnames(plot.major) <- c("Response", "N", "Proportion")
kable(plot.major)
Very uncomfortable |
127 |
44.405594 |
Somewhat uncomfortable |
109 |
38.111888 |
Somewhat comfortable |
39 |
13.636364 |
Very comfortable |
11 |
3.846154 |
Don’t know |
0 |
0.000000 |
A major urban or suburban street with four lanes, on-street parking, traffic speeds of 50-60 km per hour, but with a striped bike lane added
lane <- prop.table(table(factor(d$Q7_bike_comf_e, levels = c("1", "2", "3", "4", "77"))))*100
lane <- as.data.frame(lane)
lane$answer <- substring(row.names(lane), 1)
lane$answer <- revalue(as.character(lane$answer), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
lane$plot <- factor(lane$answer, lane$answer)
lane.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
lane.plot + geom_bar(aes(x = plot), data = lane, stat = "identity", colour="black")

lane.tb <- as.factor(d$Q7_bike_comf_e)
lane.tb <- summary(lane.tb)
lane.tb <- as.data.frame(lane.tb)
lane.tb$Var1 <- substring(row.names(lane.tb), 1)
nval.df <- c("0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$lane.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c( "77")
nval.df <- nval.df[-c(1)]
lane.tb <- rbind(lane.tb, nval.df)
lane.tb$answer <- revalue(as.character(lane.tb$Var1), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "77" = "Don't know"))
plot.lane <- merge(lane, lane.tb, by = "answer")
plot.lane <- plot.lane[-c(2, 4, 6)]
plot.lane <- setcolorder(plot.lane, c("answer", "lane.tb", "Freq"))
plot.lane$order <- c(5, 3, 2, 4, 1)
plot.lane <- plot.lane %>% arrange(order)
plot.lane <- plot.lane[-c(4)]
colnames(plot.lane) <- c("Response", "N", "Proportion")
kable(plot.lane)
Very uncomfortable |
26 |
9.090909 |
Somewhat uncomfortable |
88 |
30.769231 |
Somewhat comfortable |
131 |
45.804196 |
Very comfortable |
41 |
14.335664 |
Don’t know |
0 |
0.000000 |
A major urban or suburban street with four lanes, on-street parking, traffic speeds of 50-60 km per hour, but with a wide bike lane physically separated from traffic by a raised curb, planters, or parked cars
track <- prop.table(table(factor(d$Q7_bike_comf_f, levels = c("1", "2", "3", "4", "77"))))*100
track <- as.data.frame(track)
track$answer <- substring(row.names(track), 1)
track$answer <- revalue(as.character(track$answer), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "5" = "Don't know"))
track$plot <- factor(track$answer, track$answer)
track.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
track.plot + geom_bar(aes(x = plot), data = track, stat = "identity", colour="black")

track.tb <- as.factor(d$Q7_bike_comf_f)
track.tb <- summary(track.tb)
track.tb <- as.data.frame(track.tb)
track.tb$Var1 <- substring(row.names(track.tb), 1)
track.tb$answer <- revalue(as.character(track.tb$Var1), c("1" = "Very uncomfortable", "2" = "Somewhat uncomfortable", "3" = "Somewhat comfortable", "4" = "Very comfortable", "77" = "Don't know"))
plot.track <- merge(track, track.tb, by = "answer")
plot.track <- plot.track[-c(2, 4, 6)]
plot.track <- setcolorder(plot.track, c("answer", "track.tb", "Freq"))
plot.track$order <- c(5, 3, 2, 4, 1)
plot.track <- plot.track %>% arrange(order)
plot.track <- plot.track[-c(4)]
colnames(plot.track) <- c("Response", "N", "Proportion")
kable(plot.track)
Very uncomfortable |
20 |
6.993007 |
Somewhat uncomfortable |
10 |
3.496504 |
Somewhat comfortable |
58 |
20.279720 |
Very comfortable |
195 |
68.181818 |
Don’t know |
3 |
1.048951 |
Q9: Do you think that the All Ages and Abilities (AAA) Network is a good or bad idea for Victoria? It is a…
aaa.idea <- prop.table(table(factor(d$Q9_aaa_idea, levels = c("1", "2", "3", "4", "77")), exclude=NULL))*100
aaa.idea <- as.data.frame(aaa.idea)
aaa.idea$answer <- substring(row.names(aaa.idea), 1)
aaa.idea$answer <- revalue(as.character(aaa.idea$answer), c("1" = "Very good idea", "2" = "Somewhat good idea", "3" = "Somewhat bad idea", "4" = "Very bad idea", "5" = "Don't know", "6" = "NA"))
aaa.idea$plot <- factor(aaa.idea$answer, aaa.idea$answer)
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey", "grey")
aaa.idea.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
aaa.idea.plot + geom_bar(aes(x = plot), data = aaa.idea, stat = "identity", colour="black")

aaa.idea.tb <- as.factor(d$Q9_aaa_idea)
aaa.idea.tb <- summary(aaa.idea.tb)
aaa.idea.tb <- as.data.frame(aaa.idea.tb)
aaa.idea.tb$Var1 <- substring(row.names(aaa.idea.tb), 1)
aaa.idea.tb$answer <- revalue(as.character(aaa.idea.tb$Var1), c("1" = "Very good idea", "2" = "Somewhat good idea", "3" = "Somewhat bad idea", "4" = "Very bad idea", "77" = "Don't know", "NA's" = "NA"))
plot.aaa.idea <- merge(aaa.idea, aaa.idea.tb, by = "answer")
plot.aaa.idea <- plot.aaa.idea[-c(2, 4, 6)]
plot.aaa.idea <- setcolorder(plot.aaa.idea, c("answer", "aaa.idea.tb", "Freq"))
plot.aaa.idea$order <- c(5, 6, 3, 2, 4, 1)
plot.aaa.idea <- plot.aaa.idea %>% arrange(order)
plot.aaa.idea <- plot.aaa.idea[-c(4)]
colnames(plot.aaa.idea) <- c("Response", "N", "Proportion")
kable(plot.aaa.idea)
Very good idea |
244 |
85.3146853 |
Somewhat good idea |
33 |
11.5384615 |
Somewhat bad idea |
3 |
1.0489510 |
Very bad idea |
1 |
0.3496503 |
Don’t know |
3 |
1.0489510 |
NA |
2 |
0.6993007 |
Q10:Will you likely cycle more in the future once the All Ages and Abilities (AAA) Network is built?
bike.more <- prop.table(table(factor(d$Q10_aaa_bike_more, levels = c("1", "2")), exclude=NULL))*100
bike.more <- as.data.frame(bike.more)
bike.more$answer <- substring(row.names(bike.more), 1)
bike.more$answer <- revalue(as.character(bike.more$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
bike.more$plot <- factor(bike.more$answer, bike.more$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
bike.more.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
bike.more.plot + geom_bar(aes(x = plot), data = bike.more, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

bike.more.tb <- as.factor(d$Q10_aaa_bike_more)
bike.more.tb <- summary(bike.more.tb)
bike.more.tb <- as.data.frame(bike.more.tb)
bike.more.tb$Var1 <- substring(row.names(bike.more.tb), 1)
bike.more.tb$answer <- revalue(as.character(bike.more.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.bike.more <- merge(bike.more, bike.more.tb, by = "answer")
plot.bike.more <- plot.bike.more[-c(2, 4, 6)]
plot.bike.more <- setcolorder(plot.bike.more, c("answer", "bike.more.tb", "Freq"))
plot.bike.more$order <- c(3, 2, 1)
plot.bike.more <- plot.bike.more %>% arrange(order)
plot.bike.more <- plot.bike.more[-c(4)]
colnames(plot.bike.more) <- c("Response", "N", "Proportion")
kable(plot.bike.more)
Yes |
223 |
77.9720280 |
No |
61 |
21.3286713 |
NA |
2 |
0.6993007 |
Q11:Do you currently have a valid driver’s license?
license <- prop.table(table(factor(d$Q11_license, levels = c("1", "2")), exclude=NULL))*100
license <- as.data.frame(license)
license$answer <- substring(row.names(license), 1)
license$answer <- revalue(as.character(license$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
license$plot <- factor(license$answer, license$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
license.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
license.plot + geom_bar(aes(x = plot), data = license, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

license.tb <- as.factor(d$Q11_)
license.tb <- summary(license.tb)
license.tb <- as.data.frame(license.tb)
license.tb$Var1 <- substring(row.names(license.tb), 1)
license.tb$answer <- revalue(as.character(license.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.license <- merge(license, license.tb, by = "answer")
plot.license <- plot.license[-c(2, 4, 6)]
plot.license <- setcolorder(plot.license, c("answer", "license.tb", "Freq"))
plot.license$order <- c(3, 2, 1)
plot.license <- plot.license %>% arrange(order)
plot.license <- plot.license[-c(4)]
colnames(plot.license) <- c("Response", "N", "Proportion")
kable(plot.license)
Yes |
275 |
96.1538462 |
No |
9 |
3.1468531 |
NA |
2 |
0.6993007 |
Q12:Do you have access to a car?
access <- prop.table(table(factor(d$Q12_car_access, levels = c("1", "2")), exclude=NULL))*100
access <- as.data.frame(access)
access$answer <- substring(row.names(access), 1)
access$answer <- revalue(as.character(access$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
access$plot <- factor(access$answer, access$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
access.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
access.plot + geom_bar(aes(x = plot), data = access, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

access.tb <- as.factor(d$Q12_car_access)
access.tb <- summary(access.tb)
access.tb <- as.data.frame(access.tb)
access.tb$Var1 <- substring(row.names(access.tb), 1)
access.tb$answer <- revalue(as.character(access.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.access <- merge(access, access.tb, by = "answer")
plot.access <- plot.access[-c(2, 4, 6)]
plot.access <- setcolorder(plot.access, c("answer", "access.tb", "Freq"))
plot.access$order <- c(3, 2, 1)
plot.access <- plot.access %>% arrange(order)
plot.access <- plot.access[-c(4)]
colnames(plot.access) <- c("Response", "N", "Proportion")
kable(plot.access)
Yes |
257 |
89.860140 |
No |
18 |
6.293706 |
NA |
11 |
3.846154 |
Q13:How many cars, trucks, or vans are kept in your household?
ggplot(d, aes(x = d$Q13_cars_household)) + geom_bar(na.rm = TRUE) + xlab("Number of cars, trucks or vans in household")

summary(d$Q13_cars_household)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.000 1.000 1.000 1.319 2.000 4.000 29
Q14: How much do you enjoy using each transportation mode?
Walking
pref.walk <- prop.table(table(factor(d$Q14_preferred_mode_a, levels = c("1", "2", "3", "4", "5")), exclude=NULL))*100
pref.walk <- as.data.frame(pref.walk)
pref.walk$answer <- substring(row.names(pref.walk), 1)
pref.walk$answer <- revalue(as.character(pref.walk$answer), c("1" = "A lot", "4" = "Not at all", "5" = "Not applicable", "6" = "NA"))
pref.walk$plot <- factor(pref.walk$answer, pref.walk$answer)
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey", "grey")
pref.walk.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
pref.walk.plot + geom_bar(aes(x = plot), data = pref.walk, stat = "identity", colour="black")

pref.walk.tb <- as.factor(d$Q14_preferred_mode_a)
pref.walk.tb <- summary(pref.walk.tb)
pref.walk.tb <- as.data.frame(pref.walk.tb)
pref.walk.tb$Var1 <- substring(row.names(pref.walk.tb), 1)
pref.walk.tb$answer <- revalue(as.character(pref.walk.tb$Var1), c("1" = "A lot", "2" = "2", "3" = "3", "4" = "Not at all", "5" = "Not applicable", "NA's" = "NA"))
plot.pref.walk <- merge(pref.walk, pref.walk.tb, by = "answer")
plot.pref.walk <- plot.pref.walk[-c(2, 4, 6)]
plot.pref.walk <- setcolorder(plot.pref.walk, c("answer", "pref.walk.tb", "Freq"))
plot.pref.walk$order <- c(2, 3, 1, 6, 5, 4)
plot.pref.walk <- plot.pref.walk %>% arrange(order)
plot.pref.walk <- plot.pref.walk[-c(4)]
colnames(plot.pref.walk) <- c("Response", "N", "Proportion")
kable(plot.pref.walk)
A lot |
159 |
55.5944056 |
2 |
94 |
32.8671329 |
3 |
21 |
7.3426573 |
Not at all |
7 |
2.4475524 |
Not applicable |
3 |
1.0489510 |
NA |
2 |
0.6993007 |
Biking
pref.bike <- prop.table(table(factor(d$Q14_preferred_mode_b, levels = c("1", "2", "3", "4", "5")), exclude=NULL))*100
pref.bike <- as.data.frame(pref.bike)
pref.bike$answer <- substring(row.names(pref.bike), 1)
pref.bike$answer <- revalue(as.character(pref.bike$answer), c("1" = "A lot", "4" = "Not at all", "5" = "Not applicable", "6" = "NA"))
pref.bike$plot <- factor(pref.bike$answer, pref.bike$answer)
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey", "grey")
pref.bike.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
pref.bike.plot + geom_bar(aes(x = plot), data = pref.bike, stat = "identity", colour="black")

pref.bike.tb <- as.factor(d$Q14_preferred_mode_b)
pref.bike.tb <- summary(pref.bike.tb)
pref.bike.tb <- as.data.frame(pref.bike.tb)
pref.bike.tb$Var1 <- substring(row.names(pref.bike.tb), 1)
nval.df <- c("0", "0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$pref.bike.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("4", "5")
nval.df <- nval.df[-c(1)]
pref.bike.tb <- rbind(pref.bike.tb, nval.df)
pref.bike.tb$answer <- revalue(as.character(pref.bike.tb$Var1), c("1" = "A lot", "2" = "2", "3" = "3", "4" = "Not at all", "5" = "Not applicable", "NA's" = "NA"))
plot.pref.bike <- merge(pref.bike, pref.bike.tb, by = "answer")
plot.pref.bike <- plot.pref.bike[-c(2, 4, 6)]
plot.pref.bike <- setcolorder(plot.pref.bike, c("answer", "pref.bike.tb", "Freq"))
plot.pref.bike$order <- c(2, 3, 1, 6, 5, 4)
plot.pref.bike <- plot.pref.bike %>% arrange(order)
plot.pref.bike <- plot.pref.bike[-c(4)]
colnames(plot.pref.bike) <- c("Response", "N", "Proportion")
kable(plot.pref.bike)
A lot |
250 |
87.4125874 |
2 |
32 |
11.1888112 |
3 |
2 |
0.6993007 |
Not at all |
0 |
0.0000000 |
Not applicable |
0 |
0.0000000 |
NA |
2 |
0.6993007 |
Public Transit
pref.transit <- prop.table(table(factor(d$Q14_preferred_mode_c, levels = c("1", "2", "3", "4", "5")), exclude=NULL))*100
pref.transit <- as.data.frame(pref.transit)
pref.transit$answer <- substring(row.names(pref.transit), 1)
pref.transit$answer <- revalue(as.character(pref.transit$answer), c("1" = "A lot", "4" = "Not at all", "5" = "Not applicable", "6" = "NA"))
pref.transit$plot <- factor(pref.transit$answer, pref.transit$answer)
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey", "grey")
pref.transit.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
pref.transit.plot + geom_bar(aes(x = plot), data = pref.transit, stat = "identity", colour="black")

pref.transit.tb <- as.factor(d$Q14_preferred_mode_c)
pref.transit.tb <- summary(pref.transit.tb)
pref.transit.tb <- as.data.frame(pref.transit.tb)
pref.transit.tb$Var1 <- substring(row.names(pref.transit.tb), 1)
pref.transit.tb$answer <- revalue(as.character(pref.transit.tb$Var1), c("1" = "A lot", "2" = "2", "3" = "3", "4" = "Not at all", "5" = "Not applicable", "NA's" = "NA"))
plot.pref.transit <- merge(pref.transit, pref.transit.tb, by = "answer")
plot.pref.transit <- plot.pref.transit[-c(2, 4, 6)]
plot.pref.transit <- setcolorder(plot.pref.transit, c("answer", "pref.transit.tb", "Freq"))
plot.pref.transit$order <- c(2, 3, 1, 6, 5, 4)
plot.pref.transit <- plot.pref.transit %>% arrange(order)
plot.pref.transit <- plot.pref.transit[-c(4)]
colnames(plot.pref.transit) <- c("Response", "N", "Proportion")
kable(plot.pref.transit)
A lot |
11 |
3.8461538 |
2 |
64 |
22.3776224 |
3 |
131 |
45.8041958 |
Not at all |
68 |
23.7762238 |
Not applicable |
10 |
3.4965035 |
NA |
2 |
0.6993007 |
Car
pref.car <- prop.table(table(factor(d$Q14_preferred_mode_d, levels = c("1", "2", "3", "4", "5")), exclude=NULL))*100
pref.car <- as.data.frame(pref.car)
pref.car$answer <- substring(row.names(pref.car), 1)
pref.car$answer <- revalue(as.character(pref.car$answer), c("1" = "A lot", "4" = "Not at all", "5" = "Not applicable", "6" = "NA"))
pref.car$plot <- factor(pref.car$answer, pref.car$answer)
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey", "grey")
pref.car.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
pref.car.plot + geom_bar(aes(x = plot), data = pref.car, stat = "identity", colour="black")

pref.car.tb <- as.factor(d$Q14_preferred_mode_d)
pref.car.tb <- summary(pref.car.tb)
pref.car.tb <- as.data.frame(pref.car.tb)
pref.car.tb$Var1 <- substring(row.names(pref.car.tb), 1)
pref.car.tb$answer <- revalue(as.character(pref.car.tb$Var1), c("1" = "A lot", "2" = "2", "3" = "3", "4" = "Not at all", "5" = "Not applicable", "NA's" = "NA"))
plot.pref.car <- merge(pref.car, pref.car.tb, by = "answer")
plot.pref.car <- plot.pref.car[-c(2, 4, 6)]
plot.pref.car <- setcolorder(plot.pref.car, c("answer", "pref.car.tb", "Freq"))
plot.pref.car$order <- c(2, 3, 1, 6, 5, 4)
plot.pref.car <- plot.pref.car %>% arrange(order)
plot.pref.car <- plot.pref.car[-c(4)]
colnames(plot.pref.car) <- c("Response", "N", "Proportion")
kable(plot.pref.car)
A lot |
31 |
10.8391608 |
2 |
101 |
35.3146853 |
3 |
111 |
38.8111888 |
Not at all |
35 |
12.2377622 |
Not applicable |
6 |
2.0979021 |
NA |
2 |
0.6993007 |
Motorcycle or scooter
pref.motor <- prop.table(table(factor(d$Q14_preferred_mode_e, levels = c("1", "2", "3", "4", "5")), exclude=NULL))*100
pref.motor <- as.data.frame(pref.motor)
pref.motor$answer <- substring(row.names(pref.motor), 1)
pref.motor$answer <- revalue(as.character(pref.motor$answer), c("1" = "A lot", "4" = "Not at all", "5" = "Not applicable", "6" = "NA"))
pref.motor$plot <- factor(pref.motor$answer, pref.motor$answer)
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey", "grey")
pref.motor.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
pref.motor.plot + geom_bar(aes(x = plot), data = pref.motor, stat = "identity", colour="black")

pref.motor.tb <- as.factor(d$Q14_preferred_mode_e)
pref.motor.tb <- summary(pref.motor.tb)
pref.motor.tb <- as.data.frame(pref.motor.tb)
pref.motor.tb$Var1 <- substring(row.names(pref.motor.tb), 1)
pref.motor.tb$answer <- revalue(as.character(pref.motor.tb$Var1), c("1" = "A lot", "2" = "2", "3" = "3", "4" = "Not at all", "5" = "Not applicable", "NA's" = "NA"))
plot.pref.motor <- merge(pref.motor, pref.motor.tb, by = "answer")
plot.pref.motor <- plot.pref.motor[-c(2, 4, 6)]
plot.pref.motor <- setcolorder(plot.pref.motor, c("answer", "pref.motor.tb", "Freq"))
plot.pref.motor$order <- c(2, 3, 1, 6, 5, 4)
plot.pref.motor <- plot.pref.motor %>% arrange(order)
plot.pref.motor <- plot.pref.motor[-c(4)]
colnames(plot.pref.motor) <- c("Response", "N", "Proportion")
kable(plot.pref.motor)
A lot |
8 |
2.7972028 |
2 |
15 |
5.2447552 |
3 |
8 |
2.7972028 |
Not at all |
30 |
10.4895105 |
Not applicable |
223 |
77.9720280 |
NA |
2 |
0.6993007 |
Other
pref.other <- prop.table(table(factor(d$Q14_preferred_mode_a, levels = c("1", "2", "3", "4", "5")), exclude=NULL))*100
pref.other <- as.data.frame(pref.other)
pref.other$answer <- substring(row.names(pref.other), 1)
pref.other$answer <- revalue(as.character(pref.other$answer), c("1" = "A lot", "4" = "Not at all", "5" = "Not applicable", "6" = "NA"))
pref.other$plot <- factor(pref.other$answer, pref.other$answer)
cols <- c(rev(brewer.pal(4,"RdYlGn")),"grey", "grey")
pref.other.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
pref.other.plot + geom_bar(aes(x = plot), data = pref.other, stat = "identity", colour="black")

pref.other.tb <- as.factor(d$Q14_preferred_mode_a)
pref.other.tb <- summary(pref.other.tb)
pref.other.tb <- as.data.frame(pref.other.tb)
pref.other.tb$Var1 <- substring(row.names(pref.other.tb), 1)
pref.other.tb$answer <- revalue(as.character(pref.other.tb$Var1), c("1" = "A lot", "2" = "2", "3" = "3", "4" = "Not at all", "5" = "Not applicable", "NA's" = "NA"))
plot.pref.other <- merge(pref.other, pref.other.tb, by = "answer")
plot.pref.other <- plot.pref.other[-c(2, 4, 6)]
plot.pref.other <- setcolorder(plot.pref.other, c("answer", "pref.other.tb", "Freq"))
plot.pref.other$order <- c(2, 3, 1, 6, 5, 4)
plot.pref.other <- plot.pref.other %>% arrange(order)
plot.pref.other <- plot.pref.other[-c(4)]
colnames(plot.pref.other) <- c("Response", "N", "Proportion")
kable(plot.pref.other)
A lot |
159 |
55.5944056 |
2 |
94 |
32.8671329 |
3 |
21 |
7.3426573 |
Not at all |
7 |
2.4475524 |
Not applicable |
3 |
1.0489510 |
NA |
2 |
0.6993007 |
carshare.df <- c("Car2Go", "Modo", "ZipCar", "Other") #insert missing values
carshare.df <- as.data.frame(carshare.df)
carshare.df$Members <- c("21", "46", "5", "7")
as.numeric(carshare.df$Members)
## [1] 21 46 5 7
colnames(carshare.df) <- c("Carshare", "N Respondents")
Q15:Which car share services are you a member of??
noshare<- prop.table(table(factor(d$Q15_car_share_None, levels = c("0", "1")), exclude=NULL))*100
noshare <- as.data.frame(noshare)
noshare$answer <- substring(row.names(noshare), 1)
noshare$answer <- revalue(as.character(noshare$answer), c("1" = "Member", "2" = "Non-member", "3" = "NA"))
noshare$plot <- factor(noshare$answer, noshare$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
noshare.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
noshare.plot + geom_bar(aes(x = plot), data = noshare, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

noshare.tb <- as.factor(d$Q15_car_share_None)
noshare.tb <- summary(noshare.tb)
noshare.tb <- as.data.frame(noshare.tb)
noshare.tb$Var1 <- substring(row.names(noshare.tb), 1)
noshare.tb$answer <- revalue(as.character(noshare.tb$Var1), c("0" = "Member", "1" = "Non-member", "NA's" = "NA"))
plot.noshare <- merge(noshare, noshare.tb, by = "answer")
plot.noshare <- plot.noshare[-c(2, 4, 6)]
plot.noshare <- setcolorder(plot.noshare, c("answer", "noshare.tb", "Freq"))
plot.noshare$order <- c(1, 3, 2)
plot.noshare <- plot.noshare %>% arrange(order)
plot.noshare <- plot.noshare[-c(4)]
colnames(plot.noshare) <- c("Response", "N", "Proportion")
kable(plot.noshare)
Member |
60 |
20.9790210 |
Non-member |
224 |
78.3216783 |
NA |
2 |
0.6993007 |
kable(carshare.df)
Car2Go |
21 |
Modo |
46 |
ZipCar |
5 |
Other |
7 |
-Some respondents are members of more than one carshare service Other carshare companies:
Evo (Vancouver, n=6)
Pogo (Edmonton, n=1)
Q16:Are you a member of a bike advocacy group (e.g., Greater Victoria Cycling Coalition)?
advocacy <- prop.table(table(factor(d$Q16_bike_advocacy, levels = c("1", "2")), exclude=NULL))*100
advocacy <- as.data.frame(advocacy)
advocacy$answer <- substring(row.names(advocacy), 1)
advocacy$answer <- revalue(as.character(advocacy$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
advocacy$plot <- factor(advocacy$answer, advocacy$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
advocacy.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
advocacy.plot + geom_bar(aes(x = plot), data = advocacy, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

advocacy.tb <- as.factor(d$Q16_bike_advocacy)
advocacy.tb <- summary(advocacy.tb)
advocacy.tb <- as.data.frame(advocacy.tb)
advocacy.tb$Var1 <- substring(row.names(advocacy.tb), 1)
advocacy.tb$answer <- revalue(as.character(advocacy.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.advocacy <- merge(advocacy, advocacy.tb, by = "answer")
plot.advocacy <- plot.advocacy[-c(2, 4, 6)]
plot.advocacy <- setcolorder(plot.advocacy, c("answer", "advocacy.tb", "Freq"))
plot.advocacy$order <- c(3, 2, 1)
plot.advocacy <- plot.advocacy %>% arrange(order)
plot.advocacy <- plot.advocacy[-c(4)]
colnames(plot.advocacy) <- c("Response", "N", "Proportion")
kable(plot.advocacy)
Yes |
65 |
22.7272727 |
No |
219 |
76.5734266 |
NA |
2 |
0.6993007 |
Q17:Do you ride with a recreational cycling group or club (e.g., Tripleshot, TriStars)?
group <- prop.table(table(factor(d$Q17_cycling_club, levels = c("1", "2")), exclude=NULL))*100
group <- as.data.frame(group)
group$answer <- substring(row.names(group), 1)
group$answer <- revalue(as.character(group$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
group$plot <- factor(group$answer, group$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
group.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
group.plot + geom_bar(aes(x = plot), data = group, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

group.tb <- as.factor(d$Q17_cycling_club)
group.tb <- summary(group.tb)
group.tb <- as.data.frame(group.tb)
group.tb$Var1 <- substring(row.names(group.tb), 1)
group.tb$answer <- revalue(as.character(group.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.group <- merge(group, group.tb, by = "answer")
plot.group <- plot.group[-c(2, 4, 6)]
plot.group <- setcolorder(plot.group, c("answer", "group.tb", "Freq"))
plot.group$order <- c(3, 2, 1)
plot.group <- plot.group %>% arrange(order)
plot.group <- plot.group[-c(4)]
colnames(plot.group) <- c("Response", "N", "Proportion")
kable(plot.group)
Yes |
46 |
16.0839161 |
No |
238 |
83.2167832 |
NA |
2 |
0.6993007 |
Section 2: Housing
Q18: Thinking about where you live now, are you .
tenure <- prop.table(table(factor(d$Q18_house_tenure, levels = c("1", "2", "3", "4", "5", "77")), exclude=NULL))*100
tenure <- as.data.frame(tenure)
tenure$answer <- substring(row.names(tenure), 1)
tenure$answer <- revalue(as.character(tenure$answer), c("1" = "An owner", "2" = "A tenant", "3" = "Resident in a relative or friend's home", "4" = "Resident other than in a relative or friend's home", "5" = "Other", "6" = "Don't know", "7" = "No anwer"))
tenure$plot <- factor(tenure$answer, tenure$answer)
tenure.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
tenure.plot + geom_bar(aes(x = plot), data = tenure, stat = "identity", colour="black")

tenure.tb <- as.factor(d$Q18_house_tenure)
tenure.tb <- summary(tenure.tb)
tenure.tb <- as.data.frame(tenure.tb)
tenure.tb$Var1 <- substring(row.names(tenure.tb), 1)
nval.df <- c("0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$tenure.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("77")
nval.df <- nval.df[-c(1)]
tenure.tb <- rbind(tenure.tb, nval.df)
tenure.tb$answer <- revalue(as.character(tenure.tb$Var1), c("1" = "An owner", "2" = "A tenant", "3" = "Resident in a relative or friend's home", "4" = "Resident other than in a relative or friend's home", "5" = "Other", "77" = "Don't know", "NA's" = "No anwer"))
plot.tenure <- merge(tenure, tenure.tb, by = "answer")
plot.tenure <- plot.tenure[-c(2, 4, 6)]
plot.tenure <- setcolorder(plot.tenure, c("answer", "tenure.tb", "Freq"))
plot.tenure$order <- c(2, 1, 6, 7, 5, 3, 4)
plot.tenure <- plot.tenure %>% arrange(order)
plot.tenure <- plot.tenure[-c(4)]
colnames(plot.tenure) <- c("Response", "N", "Proportion")
kable(plot.tenure)
An owner |
179 |
62.5874126 |
A tenant |
90 |
31.4685315 |
Resident in a relative or friend’s home |
11 |
3.8461538 |
Resident other than in a relative or friend’s home |
2 |
0.6993007 |
Other |
2 |
0.6993007 |
Don’t know |
0 |
0.0000000 |
No anwer |
2 |
0.6993007 |
Q19: In what type of dwelling to you currently live? Is it.
dwelling <- prop.table(table(factor(d$Q19_dwelling_type, levels = c("1", "2", "3", "4", "5", "6", "7", "8", "10", "77")), exclude=NULL))*100
dwelling <- as.data.frame(dwelling)
dwelling$answer <- substring(row.names(dwelling), 1)
dwelling$answer <- revalue(as.character(dwelling$answer), c("1" = "Single detached house", "2" = "Semi-detached house", "3" = "Row house", "4" = "An apartment (or condo) in a duplex or triplex", "5" = "Apartment (or condo) in building with fewer than 5 storeys", "6" = "Apartment (or condo) in building with more than 5 storeys", "7" = "Mobile home/movable dwelling", "8" = "Senior's home", "9" = "Other", "10" = "Don't know", "11" = "NA"))
dwelling$plot <- factor(dwelling$answer, dwelling$answer)
dwelling.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn") +
ylab("Percent of total") +
xlab("")
dwelling.plot + geom_bar(aes(x = plot), data = dwelling, stat = "identity", colour="black")

dwelling.tb <- as.factor(d$Q19_dwelling_type)
dwelling.tb <- summary(dwelling.tb)
dwelling.tb <- as.data.frame(dwelling.tb)
dwelling.tb$Var1 <- substring(row.names(dwelling.tb), 1)
nval.df <- c("0", "0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$dwelling.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("8", "77")
nval.df <- nval.df[-c(1)]
dwelling.tb <- rbind(dwelling.tb, nval.df)
dwelling.tb$answer <- revalue(as.character(dwelling.tb$Var1), c("1" = "Single detached house", "2" = "Semi-detached house", "3" = "Row house", "4" = "An apartment (or condo) in a duplex or triplex", "5" = "Apartment (or condo) in building with fewer than 5 storeys", "6" = "Apartment (or condo) in building with more than 5 storeys", "7" = "Mobile home/movable dwelling", "8" = "Senior's home", "10" = "Other", "77" = "Don't know", "NA's" = "NA"))
plot.dwelling <- merge(dwelling, dwelling.tb, by = "answer")
plot.dwelling <- plot.dwelling[-c(2, 4, 6)]
plot.dwelling <- setcolorder(plot.dwelling, c("answer", "dwelling.tb", "Freq"))
plot.dwelling$order <- c(4, 5, 6, 10, 7, 11, 9, 3, 2, 8, 1)
plot.dwelling <- plot.dwelling %>% arrange(order)
plot.dwelling <- plot.dwelling[-c(4)]
colnames(plot.dwelling) <- c("Response", "N", "Proportion")
kable(plot.dwelling)
Single detached house |
169 |
59.0909091 |
Semi-detached house |
15 |
5.2447552 |
Row house |
16 |
5.5944056 |
An apartment (or condo) in a duplex or triplex |
15 |
5.2447552 |
Apartment (or condo) in building with fewer than 5 storeys |
43 |
15.0349650 |
Apartment (or condo) in building with more than 5 storeys |
19 |
6.6433566 |
Mobile home/movable dwelling |
1 |
0.3496503 |
Senior’s home |
0 |
0.0000000 |
Other |
6 |
2.0979021 |
Don’t know |
0 |
0.0000000 |
NA |
2 |
0.6993007 |
Section 4: General Health
Q39: How tall are you? (Choose either feet or centimetres)
ggplot(d, aes(x = d$Q39_height)) + geom_histogram(na.rm = TRUE, binwidth = 1) + xlab("Height (cm)")

summary(d$Q39_height)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 155.0 165.0 170.0 172.3 178.5 201.0 6
Q40: How much do you weigh? (Choose either pounds or kilograms)
ggplot(d, aes(x = d$Q40_weight)) + geom_histogram(na.rm = TRUE, binwidth = 2) + xlab("Weight (kg)")

summary(d$Q40_weight)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 45.00 61.00 70.00 71.75 80.25 150.00 6
Q41: In general, would you say your health is:
health <- prop.table(table(factor(d$Q41, levels = c("1", "2", "3", "4", "5")), exclude=NULL))*100
health <- as.data.frame(health)
health$answer <- substring(row.names(health), 1)
health$answer <- revalue(as.character(health$answer), c("1" = "Excellent", "2" = "Very good", "3" = "Good", "4" = "Fair", "5" = "Poor", "6" = "No anwer"))
health$plot <- factor(health$answer, health$answer)
health.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("")
health.plot + geom_bar(aes(x = plot), data = health, stat = "identity", colour="black")

health.tb <- as.factor(d$Q41_sf1)
health.tb <- summary(health.tb)
health.tb <- as.data.frame(health.tb)
health.tb$Var1 <- substring(row.names(health.tb), 1)
health.tb$answer <- revalue(as.character(health.tb$Var1), c("1" = "Excellent", "2" = "Very good", "3" = "Good", "4" = "Fair", "5" = "Poor", "NA's" = "No anwer"))
plot.health <- merge(health, health.tb, by = "answer")
plot.health <- plot.health[-c(2, 4, 6)]
plot.health <- setcolorder(plot.health, c("answer", "health.tb", "Freq"))
plot.health$order <- c(1, 4, 3, 6, 5, 2)
plot.health <- plot.health %>% arrange(order)
plot.health <- plot.health[-c(4)]
colnames(plot.health) <- c("Response", "N", "Proportion")
kable(plot.health)
Excellent |
69 |
24.1258741 |
Very good |
138 |
48.2517483 |
Good |
59 |
20.6293706 |
Fair |
13 |
4.5454545 |
Poor |
1 |
0.3496503 |
No anwer |
6 |
2.0979021 |
Q42:The following items are about activities you might do during a typical day. Does your health now limit you in these activities? If so, how much?
Moderate activities such as moving a table, pushing a vacuum cleaner, bowling, or playing golf
mod <- prop.table(table(factor(d$Q42_sf2, levels = c("1", "2", "3")), exclude = NULL))*100
mod <- as.data.frame(mod)
mod$answer <- substring(row.names(mod), 1)
mod$answer <- revalue(as.character(mod$answer), c("1" = "Yes, limited a lot", "2" = "Yes, limited a little", "3" = "No, not at all", "4" = "NA"))
mod$plot <- factor(mod$answer, mod$answer)
cols <- c(brewer.pal(3,"RdYlGn"),"grey")
mod.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
mod.plot + geom_bar(aes(x = plot), data = mod, stat = "identity", colour="black")

mod.tb <- as.factor(d$Q42_sf2)
mod.tb <- summary(mod.tb)
mod.tb <- as.data.frame(mod.tb)
mod.tb$Var1 <- substring(row.names(mod.tb), 1)
mod.tb$answer <- revalue(as.character(mod.tb$Var1), c("1" = "Yes, limited a lot", "2" = "Yes, limited a little", "3" = "No, not at all", "NA's" = "NA"))
plot.mod <- merge(mod, mod.tb, by = "answer")
plot.mod <- plot.mod[-c(2, 4, 6)]
plot.mod <- setcolorder(plot.mod, c("answer", "mod.tb", "Freq"))
plot.mod$order <- c(4, 3, 2, 1)
plot.mod <- plot.mod %>% arrange(order)
plot.mod <- plot.mod[-c(4)]
colnames(plot.mod) <- c("Response", "N", "Proportion")
kable(plot.mod)
Yes, limited a lot |
3 |
1.048951 |
Yes, limited a little |
20 |
6.993007 |
No, not at all |
257 |
89.860140 |
NA |
6 |
2.097902 |
Climbing several flights of stairs
stairs <- prop.table(table(factor(d$Q42_sf3, levels = c("1", "2", "3")), exclude = NULL))*100
stairs <- as.data.frame(stairs)
stairs$answer <- substring(row.names(stairs), 1)
stairs$answer <- revalue(as.character(stairs$answer), c("1" = "Yes, limited a lot", "2" = "Yes, limited a little", "3" = "No, not at all", "4" = "NA"))
stairs$plot <- factor(stairs$answer, stairs$answer)
cols <- c(brewer.pal(3,"RdYlGn"),"grey")
stairs.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("")
stairs.plot + geom_bar(aes(x = plot), data = stairs, stat = "identity", colour="black")

stairs.tb <- as.factor(d$Q42_sf3)
stairs.tb <- summary(stairs.tb)
stairs.tb <- as.data.frame(stairs.tb)
stairs.tb$Var1 <- substring(row.names(stairs.tb), 1)
stairs.tb$answer <- revalue(as.character(stairs.tb$Var1), c("1" = "Yes, limited a lot", "2" = "Yes, limited a little", "3" = "No, not at all", "NA's" = "NA"))
plot.stairs <- merge(stairs, stairs.tb, by = "answer")
plot.stairs <- plot.stairs[-c(2, 4, 6)]
plot.stairs <- setcolorder(plot.stairs, c("answer", "stairs.tb", "Freq"))
plot.stairs$order <- c(4, 3, 2, 1)
plot.stairs <- plot.stairs %>% arrange(order)
plot.stairs <- plot.stairs[-c(4)]
colnames(plot.stairs) <- c("Response", "N", "Proportion")
kable(plot.stairs)
Yes, limited a lot |
5 |
1.748252 |
Yes, limited a little |
20 |
6.993007 |
No, not at all |
255 |
89.160839 |
NA |
6 |
2.097902 |
Q43: During the past 4 weeks, have you had any of the following problems with your work or other regular daily activities as a result of your physical health?
Accomplished less than you would like
Q43.a <- prop.table(table(factor(d$Q43_sf4, levels = c("1", "2")), exclude = NULL))*100
Q43.a <- as.data.frame(Q43.a)
Q43.a$answer <- substring(row.names(Q43.a), 1)
Q43.a$answer <- revalue(as.character(Q43.a$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
Q43.a$plot <- factor(Q43.a$answer, Q43.a$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
Q43.a.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
Q43.a.plot + geom_bar(aes(x = plot), data = Q43.a, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

Q43.a.tb <- as.factor(d$Q43_sf4)
Q43.a.tb <- summary(Q43.a.tb)
Q43.a.tb <- as.data.frame(Q43.a.tb)
Q43.a.tb$Var1 <- substring(row.names(Q43.a.tb), 1)
Q43.a.tb$answer <- revalue(as.character(Q43.a.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.Q43.a <- merge(Q43.a, Q43.a.tb, by = "answer")
plot.Q43.a <- plot.Q43.a[-c(2, 4, 6)]
plot.Q43.a <- setcolorder(plot.Q43.a, c("answer", "Q43.a.tb", "Freq"))
plot.Q43.a$order <- c(3, 2, 1)
plot.Q43.a <- plot.Q43.a %>% arrange(order)
plot.Q43.a <- plot.Q43.a[-c(4)]
colnames(plot.Q43.a) <- c("Response", "N", "Proportion")
kable(plot.Q43.a)
Yes |
58 |
20.279720 |
No |
222 |
77.622378 |
NA |
6 |
2.097902 |
Were limited in the kind of work or other activities
Q43.b <- prop.table(table(factor(d$Q43_sf5, levels = c("1", "2")), exclude = NULL))*100
Q43.b <- as.data.frame(Q43.b)
Q43.b$answer <- substring(row.names(Q43.b), 1)
Q43.b$answer <- revalue(as.character(Q43.b$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
Q43.b$plot <- factor(Q43.b$answer, Q43.b$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
Q43.b.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
Q43.b.plot + geom_bar(aes(x = plot), data = Q43.b, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

Q43.b.tb <- as.factor(d$Q43_sf5)
Q43.b.tb <- summary(Q43.b.tb)
Q43.b.tb <- as.data.frame(Q43.b.tb)
Q43.b.tb$Var1 <- substring(row.names(Q43.b.tb), 1)
Q43.b.tb$answer <- revalue(as.character(Q43.b.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.Q43.b <- merge(Q43.b, Q43.b.tb, by = "answer")
plot.Q43.b <- plot.Q43.b[-c(2, 4, 6)]
plot.Q43.b <- setcolorder(plot.Q43.b, c("answer", "Q43.b.tb", "Freq"))
plot.Q43.b$order <- c(3, 2, 1)
plot.Q43.b <- plot.Q43.b %>% arrange(order)
plot.Q43.b <- plot.Q43.b[-c(4)]
colnames(plot.Q43.b) <- c("Response", "N", "Proportion")
kable(plot.Q43.b)
Yes |
48 |
16.783217 |
No |
232 |
81.118881 |
NA |
6 |
2.097902 |
Q44: During the past 4 weeks, have you had any of the following problems with your work or other regular daily activities as a result of any emotional problems (such as feeling depressed or anxious)?
Accomplished less than you would like
Q44.a <- prop.table(table(factor(d$Q44_sf6, levels = c("1", "2")), exclude = NULL))*100
Q44.a <- as.data.frame(Q44.a)
Q44.a$answer <- substring(row.names(Q44.a), 1)
Q44.a$answer <- revalue(as.character(Q44.a$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
Q44.a$plot <- factor(Q44.a$answer, Q44.a$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
Q44.a.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
Q44.a.plot + geom_bar(aes(x = plot), data = Q44.a, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

Q44.a.tb <- as.factor(d$Q44_sf6)
Q44.a.tb <- summary(Q44.a.tb)
Q44.a.tb <- as.data.frame(Q44.a.tb)
Q44.a.tb$Var1 <- substring(row.names(Q44.a.tb), 1)
Q44.a.tb$answer <- revalue(as.character(Q44.a.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.Q44.a <- merge(Q44.a, Q44.a.tb, by = "answer")
plot.Q44.a <- plot.Q44.a[-c(2, 4, 6)]
plot.Q44.a <- setcolorder(plot.Q44.a, c("answer", "Q44.a.tb", "Freq"))
plot.Q44.a$order <- c(3, 2, 1)
plot.Q44.a <- plot.Q44.a %>% arrange(order)
plot.Q44.a <- plot.Q44.a[-c(4)]
colnames(plot.Q44.a) <- c("Response", "N", "Proportion")
kable(plot.Q44.a)
Yes |
62 |
21.678322 |
No |
218 |
76.223776 |
NA |
6 |
2.097902 |
Did work or activities less carefully than usual
Q44.b <- prop.table(table(factor(d$Q44_sf7, levels = c("1", "2")), exclude = NULL))*100
Q44.b <- as.data.frame(Q44.b)
Q44.b$answer <- substring(row.names(Q44.b), 1)
Q44.b$answer <- revalue(as.character(Q44.b$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
Q44.b$plot <- factor(Q44.b$answer, Q44.b$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
Q44.b.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
Q44.b.plot + geom_bar(aes(x = plot), data = Q44.b, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

Q44.b.tb <- as.factor(d$Q44_sf7)
Q44.b.tb <- summary(Q44.b.tb)
Q44.b.tb <- as.data.frame(Q44.b.tb)
Q44.b.tb$Var1 <- substring(row.names(Q44.b.tb), 1)
Q44.b.tb$answer <- revalue(as.character(Q44.b.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.Q44.b <- merge(Q44.b, Q44.b.tb, by = "answer")
plot.Q44.b <- plot.Q44.b[-c(2, 4, 6)]
plot.Q44.b <- setcolorder(plot.Q44.b, c("answer", "Q44.b.tb", "Freq"))
plot.Q44.b$order <- c(3, 2, 1)
plot.Q44.b <- plot.Q44.b %>% arrange(order)
plot.Q44.b <- plot.Q44.b[-c(4)]
colnames(plot.Q44.b) <- c("Response", "N", "Proportion")
kable(plot.Q44.b)
Yes |
50 |
17.482518 |
No |
230 |
80.419580 |
NA |
6 |
2.097902 |
Q45:During the past 4 weeks, how much did pain interfere with your normal work (including work outside the home and housework)?
pain <- prop.table(table(factor(d$Q45_sf8, levels = c("1", "2", "3", "4", "5")), exclude = NULL))*100
pain <- as.data.frame(pain)
pain$answer <- substring(row.names(pain), 1)
pain$answer <- revalue(as.character(pain$answer), c("1" = "Not at all", "2" = "Slightly", "3" = "Moderately", "4" = "Quite a bit", "5" = "Extremely", "6" = "NA"))
pain$plot <- factor(pain$answer, pain$answer)
pain.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("")
pain.plot + geom_bar(aes(x = plot), data = pain, stat = "identity", colour="black")

pain.tb <- as.factor(d$Q45_sf8)
pain.tb <- summary(pain.tb)
pain.tb <- as.data.frame(pain.tb)
pain.tb$Var1 <- substring(row.names(pain.tb), 1)
pain.tb$answer <- revalue(as.character(pain.tb$Var1), c("1" = "Not at all", "2" = "Slightly", "3" = "Moderately", "4" = "Quite a bit", "5" = "Extremely", "NA's" = "NA"))
plot.pain <- merge(pain, pain.tb, by = "answer")
plot.pain <- plot.pain[-c(2, 4, 6)]
plot.pain <- setcolorder(plot.pain, c("answer", "pain.tb", "Freq"))
plot.pain$order <- c(5, 3, 6, 1, 4, 2)
plot.pain <- plot.pain %>% arrange(order)
plot.pain <- plot.pain[-c(4)]
colnames(plot.pain) <- c("Response", "N", "Proportion")
kable(plot.pain)
Not at all |
176 |
61.538461 |
Slightly |
74 |
25.874126 |
Moderately |
18 |
6.293706 |
Quite a bit |
9 |
3.146853 |
Extremely |
3 |
1.048951 |
NA |
6 |
2.097902 |
Q46:How much of the time during the past 4 weeks…
Have you felt calm and peaceful?
peace <- prop.table(table(factor(d$Q46_sf9, levels = c("1", "2", "3", "4", "5", "6")), exclude = NULL))*100
peace <- as.data.frame(peace)
peace$answer <- substring(row.names(peace), 1)
peace$answer <- revalue(as.character(peace$answer), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "7" = "NA"))
peace$plot <- factor(peace$answer, peace$answer)
peace.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("")
peace.plot + geom_bar(aes(x = plot), data = peace, stat = "identity", colour="black")

peace.tb <- as.factor(d$Q46_sf9)
peace.tb <- summary(peace.tb)
peace.tb <- as.data.frame(peace.tb)
peace.tb$Var1 <- substring(row.names(peace.tb), 1)
peace.tb$answer <- revalue(as.character(peace.tb$Var1), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "NA's" = "NA"))
plot.peace <- merge(peace, peace.tb, by = "answer")
plot.peace <- plot.peace[-c(2, 4, 6)]
plot.peace <- setcolorder(plot.peace, c("answer", "peace.tb", "Freq"))
plot.peace$order <- c(3, 5, 1, 2, 7, 6 ,4)
plot.peace <- plot.peace %>% arrange(order)
plot.peace <- plot.peace[-c(4)]
colnames(plot.peace) <- c("Response", "N", "Proportion")
kable(plot.peace)
All of the time |
7 |
2.4475524 |
Most of the time |
103 |
36.0139860 |
A good bit of the time |
92 |
32.1678322 |
Some of the time |
59 |
20.6293706 |
A little of the time |
17 |
5.9440559 |
None of the time |
1 |
0.3496503 |
NA |
7 |
2.4475524 |
Did you have a lot of energy?
energy <- prop.table(table(factor(d$Q46_sf10, levels = c("1", "2", "3", "4", "5", "6")), exclude = NULL))*100
energy <- as.data.frame(energy)
energy$answer <- substring(row.names(energy), 1)
energy$answer <- revalue(as.character(energy$answer), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "7" = "NA"))
energy$plot <- factor(energy$answer, energy$answer)
energy.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("")
energy.plot + geom_bar(aes(x = plot), data = energy, stat = "identity", colour="black")

energy.tb <- as.factor(d$Q46_sf10)
energy.tb <- summary(energy.tb)
energy.tb <- as.data.frame(energy.tb)
energy.tb$Var1 <- substring(row.names(energy.tb), 1)
energy.tb$answer <- revalue(as.character(energy.tb$Var1), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "NA's" = "NA"))
plot.energy <- merge(energy, energy.tb, by = "answer")
plot.energy <- plot.energy[-c(2, 4, 6)]
plot.energy <- setcolorder(plot.energy, c("answer", "energy.tb", "Freq"))
plot.energy$order <- c(3, 5, 1, 2, 7, 6 ,4)
plot.energy <- plot.energy %>% arrange(order)
plot.energy <- plot.energy[-c(4)]
colnames(plot.energy) <- c("Response", "N", "Proportion")
kable(plot.energy)
All of the time |
11 |
3.8461538 |
Most of the time |
137 |
47.9020979 |
A good bit of the time |
68 |
23.7762238 |
Some of the time |
46 |
16.0839161 |
A little of the time |
14 |
4.8951049 |
None of the time |
2 |
0.6993007 |
NA |
8 |
2.7972028 |
Have you felt downhearted and blue?
blue <- prop.table(table(factor(d$Q46_sf11, levels = c("1", "2", "3", "4", "5", "6")), exclude = NULL))*100
blue <- as.data.frame(blue)
blue$answer <- substring(row.names(blue), 1)
blue$answer <- revalue(as.character(blue$answer), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "7" = "NA"))
blue$plot <- factor(blue$answer, blue$answer)
blue.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("")
blue.plot + geom_bar(aes(x = plot), data = blue, stat = "identity", colour="black")

blue.tb <- as.factor(d$Q46_sf11)
blue.tb <- summary(blue.tb)
blue.tb <- as.data.frame(blue.tb)
blue.tb$Var1 <- substring(row.names(blue.tb), 1)
nval.df <- c("0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$blue.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("1")
nval.df <- nval.df[-c(1)]
blue.tb <- rbind(blue.tb, nval.df)
blue.tb$answer <- revalue(as.character(blue.tb$Var1), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "NA's" = "NA"))
plot.blue <- merge(blue, blue.tb, by = "answer")
plot.blue <- plot.blue[-c(2, 4, 6)]
plot.blue <- setcolorder(plot.blue, c("answer", "blue.tb", "Freq"))
plot.blue$order <- c(3, 5, 1, 2, 7, 6 ,4)
plot.blue <- plot.blue %>% arrange(order)
plot.blue <- plot.blue[-c(4)]
colnames(plot.blue) <- c("Response", "N", "Proportion")
kable(plot.blue)
All of the time |
0 |
0.0000000 |
Most of the time |
2 |
0.6993007 |
A good bit of the time |
14 |
4.8951049 |
Some of the time |
58 |
20.2797203 |
A little of the time |
135 |
47.2027972 |
None of the time |
69 |
24.1258741 |
NA |
8 |
2.7972028 |
Q47:During the past 4 weeks, how much of the time has your physical health or emotional problems interfered with your social activities (like visiting friends, relatives, etc.)?
social <- prop.table(table(factor(d$Q47_sf12, levels = c("1", "2", "3", "4", "5", "6")), exclude = NULL))*100
social <- as.data.frame(social)
social$answer <- substring(row.names(social), 1)
social$answer <- revalue(as.character(social$answer), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "7" = "NA"))
social$plot <- factor(social$answer, social$answer)
social.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "BuGn", direction=-1) +
ylab("Percent of total") +
xlab("")
social.plot + geom_bar(aes(x = plot), data = social, stat = "identity", colour="black")

social.tb <- as.factor(d$Q47_sf12)
social.tb <- summary(social.tb)
social.tb <- as.data.frame(social.tb)
social.tb$Var1 <- substring(row.names(social.tb), 1)
nval.df <- c("0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$social.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("2")
nval.df <- nval.df[-c(1)]
social.tb <- rbind(social.tb, nval.df)
social.tb$answer <- revalue(as.character(social.tb$Var1), c("1" = "All of the time", "2" = "Most of the time", "3" = "A good bit of the time", "4" = "Some of the time", "5" = "A little of the time", "6" = "None of the time", "NA's" = "NA"))
plot.social <- merge(social, social.tb, by = "answer")
plot.social <- plot.social[-c(2, 4, 6)]
plot.social <- setcolorder(plot.social, c("answer", "social.tb", "Freq"))
plot.social$order <- c(3, 5, 1, 2, 7, 6 ,4)
plot.social <- plot.social %>% arrange(order)
plot.social <- plot.social[-c(4)]
colnames(plot.social) <- c("Response", "N", "Proportion")
kable(plot.social)
All of the time |
2 |
0.6993007 |
Most of the time |
0 |
0.0000000 |
A good bit of the time |
12 |
4.1958042 |
Some of the time |
23 |
8.0419580 |
A little of the time |
66 |
23.0769231 |
None of the time |
176 |
61.5384615 |
NA |
7 |
2.4475524 |
Section 8:Demographics
Q51:What is your marital status? Are you.
marital <- prop.table(table(factor(d$Q51_marital_status, levels = c("1", "2", "3", "4")), exclude = NULL))*100
marital <- as.data.frame(marital)
marital$answer <- substring(row.names(marital), 1)
marital$answer <- revalue(as.character(marital$answer), c("1" = "Single", "2" = "Married/commonlaw", "3" = "Separated/divorced", "4" = "Widowed", "5" = "NA"))
marital$plot <- factor(marital$answer, marital$answer)
marital.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "Set3") +
ylab("Percent of total") +
xlab("")
marital.plot + geom_bar(aes(x = plot), data = marital, stat = "identity", colour="black")

marital.tb <- as.factor(d$Q51_marital_status)
marital.tb <- summary(marital.tb)
marital.tb <- as.data.frame(marital.tb)
marital.tb$Var1 <- substring(row.names(marital.tb), 1)
marital.tb$answer <- revalue(as.character(marital.tb$Var1), c("1" = "Single", "2" = "Married/commonlaw", "3" = "Separated/divorced", "4" = "Widowed", "NA's" = "NA"))
plot.marital <- merge(marital, marital.tb, by = "answer")
plot.marital <- plot.marital[-c(2, 4, 6)]
plot.marital <- setcolorder(plot.marital, c("answer", "marital.tb", "Freq"))
plot.marital$order <- c(2, 5, 3, 1, 4)
plot.marital <- plot.marital %>% arrange(order)
plot.marital <- plot.marital[-c(4)]
colnames(plot.marital) <- c("Response", "N", "Proportion")
kable(plot.marital)
Single |
54 |
18.8811189 |
Married/commonlaw |
200 |
69.9300699 |
Separated/divorced |
23 |
8.0419580 |
Widowed |
2 |
0.6993007 |
NA |
7 |
2.4475524 |
Q52:Do you have children?
kids <- prop.table(table(factor(d$Q52_children, levels = c("1", "2")), exclude=NULL))*100
kids <- as.data.frame(kids)
kids$answer <- substring(row.names(kids), 1)
kids$answer <- revalue(as.character(kids$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
kids$plot <- factor(kids$answer, kids$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
kids.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
kids.plot + geom_bar(aes(x = plot), data = kids, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

kids.tb <- as.factor(d$Q52_children)
kids.tb <- summary(kids.tb)
kids.tb <- as.data.frame(kids.tb)
kids.tb$Var1 <- substring(row.names(kids.tb), 1)
kids.tb$answer <- revalue(as.character(kids.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.kids <- merge(kids, kids.tb, by = "answer")
plot.kids <- plot.kids[-c(2, 4, 6)]
plot.kids <- setcolorder(plot.kids, c("answer", "kids.tb", "Freq"))
plot.kids$order <- c(3, 2, 1)
plot.kids <- plot.kids %>% arrange(order)
plot.kids <- plot.kids[-c(4)]
colnames(plot.kids) <- c("Response", "N", "Proportion")
kable(plot.kids)
Yes |
149 |
52.097902 |
No |
130 |
45.454546 |
NA |
7 |
2.447552 |
Q53:How many children do you have?
nkids <- prop.table(table(factor(d$Q53_living_children, levels = c("1", "2", "3", "4", "5", "6")), exclude=NULL))*100
nkids <- as.data.frame(nkids)
nkids <- as.data.frame(nkids)
nkids$answer <- substring(row.names(nkids), 1)
nkids$answer <- revalue(as.character(nkids$answer), c("7" = "No children"))
nkids$plot <- factor(nkids$answer, nkids$answer)
cols <- c(brewer.pal(6,"YlGnBu"),"grey")
nkids.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
nkids.plot + geom_bar(aes(x = plot), data = nkids, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

nkids.tb <- as.factor(d$Q53_living_children)
nkids.tb <- summary(nkids.tb)
nkids.tb <- as.data.frame(nkids.tb)
nkids.tb$Var1 <- substring(row.names(nkids.tb), 1)
nkids.tb$answer <- revalue(as.character(nkids.tb$Var1), c("NA's" = "No children"))
plot.nkids <- merge(nkids, nkids.tb, by = "answer")
plot.nkids <- plot.nkids[-c(2, 4, 6)]
plot.nkids <- setcolorder(plot.nkids, c("answer", "nkids.tb", "Freq"))
colnames(plot.nkids) <- c("Response", "N", "Proportion")
kable(plot.nkids)
1 |
39 |
13.6363636 |
2 |
82 |
28.6713287 |
3 |
23 |
8.0419580 |
4 |
2 |
0.6993007 |
5 |
2 |
0.6993007 |
6 |
1 |
0.3496503 |
No children |
137 |
47.9020979 |
Q54:What is your current living arrangement? Do you live.
livewith <- prop.table(table(factor(d$Q54_living_arrange, levels = c("[1]", "[2]", "[3]", "[4]", "[5]", "[6]", "[7]", "[2, 3, 4, 7, 6]", "[2, 3, 4]", "[2, 3, 5]", "[2, 3]", "[2, 5]", "[2, 6]", "[2, 7]")), exclude=NULL))*100
livewith <- as.data.frame(livewith)
livewith <- as.data.frame(livewith)
livewith$answer <- substring(row.names(livewith), 1)
livewith$answer <- revalue(as.character(livewith$answer), c("1" = "Alone", "2" = "With a spouse/partner", "3" = "With children", "4" = "With grandchildren", "5" = "With relatives/siblings", "6" = "With friends", "7" = "With other people", "8" = "With spouse, children, grandchildren, friends & others", "9" = "With spouse, children & grandchildren", "10" = "With spouse, children & relatives/siblings", "11" = "With spouse & children", "12" = "With spouse & relatives/siblings", "13" = "With spouse & friends", "14" = "With spouse & others", "15" = "NA"))
livewith$plot <- factor(livewith$answer, livewith$answer)
livewith.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
livewith.plot + geom_bar(aes(x = plot), data = livewith, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_brewer(palette = "Set3") +
ylab("Percent of total") +
xlab("Response")

livewith.tb <- as.factor(d$Q54_living_arrange)
livewith.tb <- summary(livewith.tb)
livewith.tb <- as.data.frame(livewith.tb)
livewith.tb$Var1 <- substring(row.names(livewith.tb), 1)
nval.df <- c("0", "7") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$livewith.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("[4]", "NA")
nval.df <- nval.df[-c(1)]
livewith.tb <- rbind(livewith.tb, nval.df)
livewith.tb$answer <- revalue(as.character(livewith.tb$Var1), c("[1]" = "Alone", "[2]" = "With a spouse/partner", "[3]" = "With children", "[4]" = "With grandchildren", "[5]" = "With relatives/siblings", "[6]" = "With friends", "[7]" = "With other people", "[2, 3, 4, 7, 6]" = "With spouse, children, grandchildren, friends & others", "[2, 3, 4]" = "With spouse, children & grandchildren", "[2, 3, 5]" = "With spouse, children & relatives/siblings", "[2, 3]" = "With spouse & children", "[2, 5]" = "With spouse & relatives/siblings", "[2, 6]" = "With spouse & friends", "[2, 7]" = "With spouse & others"))
plot.livewith <- merge(livewith, livewith.tb, by = "answer")
plot.livewith <- plot.livewith[-c(2, 4, 6)]
plot.livewith <- setcolorder(plot.livewith, c("answer", "livewith.tb", "Freq"))
plot.livewith$order <- c(3, 15, 1, 7, 4, 13, 6, 5, 2, 10, 9, 11, 12, 8, 14)
plot.livewith <- plot.livewith %>% arrange(order)
plot.livewith <- plot.livewith[-c(4)]
colnames(plot.livewith) <- c("Response", "N", "Proportion")
kable(plot.livewith)
With a spouse/partner |
120 |
41.9580420 |
With spouse & children |
77 |
26.9230769 |
Alone |
43 |
15.0349650 |
With friends |
11 |
3.8461538 |
With relatives/siblings |
8 |
2.7972028 |
With other people |
7 |
2.4475524 |
With children |
4 |
1.3986014 |
With spouse, children & relatives/siblings |
3 |
1.0489510 |
With spouse & others |
2 |
0.6993007 |
With spouse & friends |
1 |
0.3496503 |
With spouse & relatives/siblings |
1 |
0.3496503 |
With spouse, children & grandchildren |
1 |
0.3496503 |
With grandchildren |
0 |
0.0000000 |
With spouse, children, grandchildren, friends & others |
1 |
0.3496503 |
NA |
7 |
2.4475524 |
Q57:How many adults aged 16 or older live in your household including yourself?
ggplot(d, aes(x = d$Q57_adults_household)) + geom_bar(na.rm = TRUE) + xlab("Number of adults in household")

summary(d$Q57_adults_household)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1.000 2.000 2.000 2.202 2.000 16.000 23
Q58:When did you move to your current residence?
ggplot(d, aes(x = d$Q58_residence.time)) + geom_bar(na.rm = TRUE, binwidth = 1) + xlab("Number of years at residence")

summary(d$Q58_residence.time)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1.000 2.000 5.000 7.711 10.500 38.000 23
Q59:Were you born in Canada?
can <- prop.table(table(factor(d$Q59_born_can, levels = c("1", "2")), exclude=NULL))*100
can <- as.data.frame(can)
can$answer <- substring(row.names(can), 1)
can$answer <- revalue(as.character(can$answer), c("1" = "Yes", "2" = "No", "3" = "NA"))
can$plot <- factor(can$answer, can$answer)
cols <- c("#31a354","#f03b20", "grey") #get colors for plot
can.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
can.plot + geom_bar(aes(x = plot), data = can, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_manual(values = cols) +
ylab("Percent of total") +
xlab("Response")

can.tb <- as.factor(d$Q59_born_can)
can.tb <- summary(can.tb)
can.tb <- as.data.frame(can.tb)
can.tb$Var1 <- substring(row.names(can.tb), 1)
can.tb$answer <- revalue(as.character(can.tb$Var1), c("1" = "Yes", "2" = "No", "NA's" = "NA"))
plot.can <- merge(can, can.tb, by = "answer")
plot.can <- plot.can[-c(2, 4, 6)]
plot.can <- setcolorder(plot.can, c("answer", "can.tb", "Freq"))
plot.can$order <- c(3, 2, 1)
plot.can <- plot.can %>% arrange(order)
plot.can <- plot.can[-c(4)]
colnames(plot.can) <- c("Response", "N", "Proportion")
kable(plot.can)
Yes |
194 |
67.832168 |
No |
69 |
24.125874 |
NA |
23 |
8.041958 |
imm <- d %>%
select(Q59_born_can, Q60_move_can, Q60_numYears) %>%
filter(Q59_born_can == "2")
ggplot(imm, aes(x = Q60_move_can)) + geom_bar(na.rm = TRUE, binwidth = 1) + xlab("Moved to Canada")

summary(d$Q60_move_can)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1946 1972 1988 1987 2002 2017 217
summary(d$Q60_numYears)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.0 15.0 29.0 30.3 45.0 71.0 217
Q61:To which ethnic or cultural groups did your ancestors belong? (Check all that apply)
ethnic <- prop.table(table(factor(d$Q61_group_id, levels = c("[1]", "[1, 2, 4]", "[1, 4]", "[2]", "[2, 4]", "[3]", "[4]", "[4, 6]", "[5]", "[6]", "[77]")), exclude=NULL))*100
ethnic <- as.data.frame(ethnic)
ethnic <- as.data.frame(ethnic)
ethnic$answer <- substring(row.names(ethnic), 1)
ethnic$answer <- revalue(as.character(ethnic$answer), c("1" = "Aboriginal", "2" = "Aboriginal/Asian/Caucasian", "3" = "Aboriginal/Caucasian", "4" = "Asian", "5" = "Asian/Caucasian", "6" = "Black", "7" = "Caucasian", "8" = "Caucasian/Middle Eastern", "9" = "Latin American", "10" = "Middle Eastern", "11" = "Don't know/prefer no answer", "12" = "NA"))
ethnic$plot <- factor(ethnic$answer, ethnic$answer)
ethnic.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) #order responses as in t5
ethnic.plot + geom_bar(aes(x = plot), data = ethnic, stat = "identity", colour="black") +
guides(fill = FALSE) +
scale_fill_brewer(palette = "Set3") +
ylab("Percent of total") +
xlab("Response")

ethnic.tb <- as.factor(d$Q61_group_id)
ethnic.tb <- summary(ethnic.tb)
ethnic.tb <- as.data.frame(ethnic.tb)
ethnic.tb$Var1 <- substring(row.names(ethnic.tb), 1)
nval.df <- c("0", "0", "0", "23") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$ethnic.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("[1]", "[3]","[6]", "[99]")
nval.df <- nval.df[-c(1)]
ethnic.tb <- rbind(ethnic.tb, nval.df)
ethnic.tb$answer <- revalue(as.character(ethnic.tb$Var1), c("[1]" = "Aboriginal", "[1, 2, 4]" = "Aboriginal/Asian/Caucasian", "[1, 4]" = "Aboriginal/Caucasian", "[2]" = "Asian", "[2, 4]" = "Asian/Caucasian", "[3]" = "Black", "[4]" = "Caucasian", "[4, 6]" = "Caucasian/Middle Eastern", "[5]" = "Latin American", "[6]" = "Middle Eastern", "[77]" = "Don't know/prefer no answer", "[99]" = "NA"))
plot.ethnic <- merge(ethnic, ethnic.tb, by = "answer")
plot.ethnic <- plot.ethnic[-c(2, 4, 6)]
plot.ethnic <- setcolorder(plot.ethnic, c("answer", "ethnic.tb", "Freq"))
plot.ethnic$order <- c(1, 2, 3, 4, 5, 6, 7, 8, 11, 9, 10, 12)
plot.ethnic <- plot.ethnic %>% arrange(order)
plot.ethnic <- plot.ethnic[-c(4)]
colnames(plot.ethnic) <- c("Response", "N", "Proportion")
kable(plot.ethnic)
Aboriginal |
0 |
0.0000000 |
Aboriginal/Asian/Caucasian |
1 |
0.3496503 |
Aboriginal/Caucasian |
3 |
1.0489510 |
Asian |
15 |
5.2447552 |
Asian/Caucasian |
2 |
0.6993007 |
Black |
0 |
0.0000000 |
Caucasian |
228 |
79.7202797 |
Caucasian/Middle Eastern |
1 |
0.3496503 |
Latin American |
4 |
1.3986014 |
Middle Eastern |
0 |
0.0000000 |
Don’t know/prefer no answer |
9 |
3.1468531 |
NA |
23 |
8.0419580 |
Q62: Which category best describes your annual household income, taking into account all sources of income?
income <- prop.table(table(factor(d$Q62_income, levels = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "77")), exclude = NULL))*100
income <- as.data.frame(income)
income$answer <- substring(row.names(income), 1)
income$answer <- revalue(as.character(income$answer), c("1" = "No income", "2" = "$1 to $9,999", "3" = "$10,000 to $14,999", "4" = "$15,000 to $19,999", "5" = "$20,000 to $29,999", "6" = "$30,000 to $39,999", "7" = "$40,000 to $49,999", "8" = "$50,000 to $99,999", "9" = "$100,000 to $149,999", "10" = " $150,000 to $199,999", "11" = "$200,000 or more", "12" = "Don't know/prefer no answer", "13" = "NA"))
income$plot <- factor(income$answer, income$answer)
income.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = (rev("YlGn"))) +
ylab("Percent of total") +
xlab("")
income.plot + geom_bar(aes(x = plot), data = income, stat = "identity", colour="black")

income.tb <- as.factor(d$Q62_income)
income.tb <- summary(income.tb)
income.tb <- as.data.frame(income.tb)
income.tb$Var1 <- substring(row.names(income.tb), 1)
nval.df <- c("0") #insert missing values
nval.df <- as.data.frame(nval.df)
nval.df$income.tb <- as.factor(nval.df$nval.df)
nval.df$Var1 <- c("1")
nval.df <- nval.df[-c(1)]
income.tb <- rbind(income.tb, nval.df)
income.tb$answer <- revalue(as.character(income.tb$Var1), c("1" = "No income", "2" = "$1 to $9,999", "3" = "$10,000 to $14,999", "4" = "$15,000 to $19,999", "5" = "$20,000 to $29,999", "6" = "$30,000 to $39,999", "7" = "$40,000 to $49,999", "8" = "$50,000 to $99,999", "9" = "$100,000 to $149,999", "10" = " $150,000 to $199,999", "11" = "$200,000 or more", "77" = "Don't know/prefer no answer", "NA's" = "NA"))
plot.income <- merge(income, income.tb, by = "answer")
plot.income <- plot.income[-c(2, 4, 6)]
plot.income <- setcolorder(plot.income, c("answer", "income.tb", "Freq"))
plot.income$order <- c(10, 2, 3, 9, 4, 5, 11, 6, 7, 8, 12, 13, 1)
plot.income <- plot.income %>% arrange(order)
plot.income <- plot.income[-c(4)]
colnames(plot.income) <- c("Response", "N", "Proportion")
kable(plot.income)
No income |
0 |
0.0000000 |
$1 to $9,999 |
3 |
1.0489510 |
$10,000 to $14,999 |
2 |
0.6993007 |
$15,000 to $19,999 |
5 |
1.7482517 |
$20,000 to $29,999 |
9 |
3.1468531 |
$30,000 to $39,999 |
11 |
3.8461538 |
$40,000 to $49,999 |
15 |
5.2447552 |
$50,000 to $99,999 |
99 |
34.6153846 |
$100,000 to $149,999 |
61 |
21.3286713 |
$150,000 to $199,999 |
31 |
10.8391608 |
$200,000 or more |
9 |
3.1468531 |
Don’t know/prefer no answer |
18 |
6.2937063 |
NA |
23 |
8.0419580 |
Q63: To what extent does this annual household income allow you to satisfy your household’s needs?
needs <- prop.table(table(factor(d$Q63_income_needs, levels = c("1", "2", "3", "4", "77")), exclude = NULL))*100
needs <- as.data.frame(needs)
needs$answer <- substring(row.names(needs), 1)
needs$answer <- revalue(as.character(needs$answer), c("1" = "Very well", "2" = "Well", "3" = "Not so well", "4" = "Not at all", "5" = "Don't know/prefer no answer", "6" = "NA"))
needs$plot <- factor(needs$answer, needs$answer)
needs.plot <- ggplot(plot, aes(x = answer, y = Freq, fill = plot)) + theme(axis.text.x = element_text(angle=90, vjust=.6)) +
guides(fill = FALSE) +
scale_fill_brewer(palette = "YlGn", direction=-1) +
ylab("Percent of total") +
xlab("")
needs.plot + geom_bar(aes(x = plot), data = needs, stat = "identity", colour="black")

needs.tb <- as.factor(d$Q63_income_needs)
needs.tb <- summary(needs.tb)
needs.tb <- as.data.frame(needs.tb)
needs.tb$Var1 <- substring(row.names(needs.tb), 1)
needs.tb$answer <- revalue(as.character(needs.tb$Var1), c("1" = "Very well", "2" = "Well", "3" = "Not so well", "4" = "Not at all", "77" = "Don't know/prefer no answer", "NA's" = "NA"))
plot.needs <- merge(needs, needs.tb, by = "answer")
plot.needs <- plot.needs[-c(2, 4, 6)]
plot.needs <- setcolorder(plot.needs, c("answer", "needs.tb", "Freq"))
plot.needs$order <- c(5, 6, 4, 3, 1, 2)
plot.needs <- plot.needs %>% arrange(order)
plot.needs <- plot.needs[-c(4)]
colnames(plot.needs) <- c("Response", "N", "Proportion")
kable(plot.needs)
Very well |
104 |
36.363636 |
Well |
113 |
39.510489 |
Not so well |
29 |
10.139860 |
Not at all |
5 |
1.748252 |
Don’t know/prefer no answer |
11 |
3.846154 |
NA |
24 |
8.391608 |