The INTErventions, Research, and Action in Cities Team (INTERACT) is a national research collaboration of scientists, urban planners, and engaged citizens uncovering how the design of our cities is shaping the health and wellbeing of Canadians (www.teaminteract.ca). INTERACT is conducting longitudinal, mixed-methods natural experiment studies in four Canadian cities, with the aim of providing evidence on the impacts of urban transformations on people’s physical activity, social connectedness, and wellbeing, and inequalities in these outcomes.

As part of Plan Montreal durable 2016-2020 and Montreal’s Climate Plan for 2050, the City of Montreal, its boroughs, neighbouring cities and partnering organizations are implementing urban interventions, such as new cycling infrastructure, changes in public transit infrastructure, changes in public space, and greening programs. Sampled from Montreal and it’s surroundings (including Longueuil, Brossard, Saint-Lambert, and Laval) participants were recruited from September 2020 to February 2021.

Participants were entered into a prize draw to incentivize their participation. Inclusion criteria were being above 18 years old, having a basic comprehension of English or French and not having the intention of moving out of the region in the next two years. Participants were recruited through social media, media articles and partner networks within community organisations. Responses were collected from September 7th, 2020 to February 2nd, 2021.

Across Montreal, Laval, Longueuil, Brossard and Saint-Lambert, 383 returning participants, and 218 new participants completed the Health Questionnaire, for a total of 601 responses.

Section 1: Transportation

What modes of transportation do you use? Please check all that apply.

# w2$mode_used_1[w2$mode_used_1==0] <- 2
# w2$mode_used_2[w2$mode_used_2==0] <- 2
# w2$mode_used_3[w2$mode_used_3==0] <- 2
# w2$mode_used_4[w2$mode_used_4==0] <- 2
# w2$mode_used_5[w2$mode_used_5==0] <- 2
# w2$mode_used_6[w2$mode_used_6==0] <- 2
# w2$mode_used_7[w2$mode_used_7==0] <- 2
# w2$mode_used_8[w2$mode_used_8==0] <- 2

# mode used

t_1 <- select(w2, croise, mode_used_1, mode_used_2, mode_used_3, mode_used_4, mode_used_5, mode_used_6, mode_used_7, mode_used_8)
t_1 <- pivot_longer(t_1,
   cols = starts_with("mode_used_"),
   names_to = "mode",
   names_prefix = "mode_used_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$mode[t_1$mode== 1] <- "1. Walking"
t_1$mode[t_1$mode== 2] <- "2. Biking "
t_1$mode[t_1$mode== 3] <- "3. Public Transitl"
t_1$mode[t_1$mode== 4] <- "4. Car"
t_1$mode[t_1$mode== 5] <- "5. Motorcycle/scooter"
t_1$mode[t_1$mode== 6] <- "6. Taxi/Uber"
t_1$mode[t_1$mode== 7] <- "7. Car-sharing service"
t_1$mode[t_1$mode== 8] <- "8. Other"


## recode
t_1$values <- recode_factor(t_1$values, "1" = "Yes", "0" = "No")

##### Table

t_1<- t_1 %>% 
  group_by(croise, mode, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= mode, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACTPaletteYN) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

Other modes- write-in options

w2$mode_used_txt[w2$mode_used_txt!=""]
##  [1] "BIXI"                                                
##  [2] "Course"                                              
##  [3] "Trottinette"                                         
##  [4] "Location occasionnelle de courte durée d'une voiture"
##  [5] "my personal car"                                     
##  [6] "Bixi"                                                
##  [7] "Covoiturage"                                         
##  [8] "Trotinette électrique"                               
##  [9] "CAR"                                                 
## [10] "Co-voiturage."                                       
## [11] "amigo"

Even if you do not personally use this mode of transportation, do you find

cycling in your city to be.

#perception_cycling_a

w2$perception_cycling_a <- recode_factor(w2$perception_cycling_a, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_cycling_b <- recode_factor(w2$perception_cycling_b, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_cycling_c <- recode_factor(w2$perception_cycling_c, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_cycling_d <- recode_factor(w2$perception_cycling_d, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_cycling_e <- recode_factor(w2$perception_cycling_e, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")


t_1 <- select(w2, croise, perception_cycling_a, perception_cycling_b, perception_cycling_c, perception_cycling_d, perception_cycling_e)
t_1 <- pivot_longer(t_1,
   cols = starts_with("perception_cycling_"),
   names_to = "perception",
   names_prefix = "perception_cycling_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "a. Safe"
t_1$perception[t_1$perception== "b"] <- "b. Reliable"
t_1$perception[t_1$perception== "c"] <- "c. Practical"
t_1$perception[t_1$perception== "d"] <- "d. Enjoyable"
t_1$perception[t_1$perception== "e"] <- "e. Affordable"

##### Table

t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

driving in your city to be.

w2$perception_driving_a <- recode_factor(w2$perception_driving_a, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_driving_b <- recode_factor(w2$perception_driving_b, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_driving_c <- recode_factor(w2$perception_driving_c, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_driving_d <- recode_factor(w2$perception_driving_d, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_driving_e <- recode_factor(w2$perception_driving_e, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")



t_1 <- select(w2, croise, perception_driving_a, perception_driving_b, perception_driving_c, perception_driving_d, perception_driving_e)
t_1 <- pivot_longer(t_1,
   cols = starts_with("perception_driving_"),
   names_to = "perception",
   names_prefix = "perception_driving_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "a. Safe"
t_1$perception[t_1$perception== "b"] <- "b. Reliable"
t_1$perception[t_1$perception== "c"] <- "c. Practical"
t_1$perception[t_1$perception== "d"] <- "d. Enjoyable"
t_1$perception[t_1$perception== "e"] <- "e. Affordable"

##### Table

t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

walking in your city to be.

w2$perception_walking_a <- recode_factor(w2$perception_walking_a, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_walking_b <- recode_factor(w2$perception_walking_b, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_walking_c <- recode_factor(w2$perception_walking_c, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_walking_d <- recode_factor(w2$perception_walking_d, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_walking_e <- recode_factor(w2$perception_walking_e, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")



t_1 <- select(w2, croise, perception_walking_a, perception_walking_b, perception_walking_c, perception_walking_d, perception_walking_e)
t_1 <- pivot_longer(t_1,
   cols = starts_with("perception_walking_"),
   names_to = "perception",
   names_prefix = "perception_walking_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "a. Safe"
t_1$perception[t_1$perception== "b"] <- "b. Reliable"
t_1$perception[t_1$perception== "c"] <- "c. Practical"
t_1$perception[t_1$perception== "d"] <- "d. Enjoyable"
t_1$perception[t_1$perception== "e"] <- "e. Affordable"

##### Table

t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

transit in your city to be.

w2$perception_transit_a <- recode_factor(w2$perception_transit_a, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_transit_b <- recode_factor(w2$perception_transit_b, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_transit_c <- recode_factor(w2$perception_transit_c, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_transit_d <- recode_factor(w2$perception_transit_d, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")
w2$perception_transit_e <- recode_factor(w2$perception_transit_e, "1" = "1. Very", "2" = "2", "3" ="3",  "4" = "4. Not at all", "77" = "I don't know")


t_1 <- select(w2, croise, perception_transit_a, perception_transit_b, perception_transit_c, perception_transit_d, perception_transit_e)
t_1 <- pivot_longer(t_1,
   cols = starts_with("perception_transit_"),
   names_to = "perception",
   names_prefix = "perception_transit_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "a. Safe"
t_1$perception[t_1$perception== "b"] <- "b. Reliable"
t_1$perception[t_1$perception== "c"] <- "c. Practical"
t_1$perception[t_1$perception== "d"] <- "d. Enjoyable"
t_1$perception[t_1$perception== "e"] <- "e. Affordable"

##### Table

t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

How often do you typically travel during each season by

bicycle

w2$bike_freq_a[w2$bike_freq_a==-7] <- NA
p1 <- ggplot(w2, aes(x = bike_freq_a)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#FFA314") + xlab("Times in the fall") + facet_grid(~croise)

w2$bike_freq_b[w2$bike_freq_b==-7] <- NA
p2 <-ggplot(w2, aes(x = bike_freq_b)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#1596FF") + xlab("Times in the winter") + facet_grid(~croise)

w2$bike_freq_c[w2$bike_freq_c==-7] <- NA
p3 <- ggplot(w2, aes(x = bike_freq_c)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#76D24A") + xlab("Times in the spring") + facet_grid(~croise)

w2$bike_freq_d[w2$bike_freq_d==-7] <- NA
p4 <- ggplot(w2, aes(x = bike_freq_d)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#F2B705") + xlab("Times in the summer") + facet_grid(~croise)


grid.arrange(p1,p2, p3, p4 )

car

w2$car_freq_a[w2$car_freq_a==-7] <- NA
p1 <- ggplot(w2, aes(x = w2$car_freq_a)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#BF5B04") + xlab("Times in the fall") + facet_grid(~croise)

w2$car_freq_b[w2$car_freq_b==-7] <- NA
p2 <- ggplot(w2, aes(x = w2$car_freq_b)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#35AAF2") + xlab("Times in the winter") + facet_grid(~croise)

w2$car_freq_c[w2$car_freq_c==-7] <- NA
p3 <- ggplot(w2, aes(x = w2$car_freq_c)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#7C8C03") + xlab("Times in the spring") + facet_grid(~croise)

w2$car_freq_d[w2$car_freq_d==-7] <- NA
p4 <- ggplot(w2, aes(x = w2$car_freq_d)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#F2B705") + xlab("Times in the summer") + facet_grid(~croise)

grid.arrange(p1,p2, p3, p4)

transit

w2$transit_freq_a[w2$transit_freq_a==-7] <- NA
p1 <- ggplot(w2, aes(x = w2$transit_freq_a)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#BF5B04") + xlab("Times in the fall") + facet_grid(~croise)

w2$transit_freq_b[w2$transit_freq_b==-7] <- NA
p2 <- ggplot(w2, aes(x = w2$transit_freq_b)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#35AAF2") + xlab("Times in the winter") + facet_grid(~croise)

w2$transit_freq_c[w2$transit_freq_c==-7] <- NA
p3 <- ggplot(w2, aes(x = w2$transit_freq_c)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#7C8C03") + xlab("Times in the spring")+ facet_grid(~croise)

w2$transit_freq_d[w2$transit_freq_d==-7] <- NA
p4 <- ggplot(w2, aes(x = w2$transit_freq_d)) + geom_histogram (na.rm = TRUE, binwidth = 5, fill="#F2B705") + xlab("Times in the summer") + facet_grid(~croise)

grid.arrange(p1,p2, p3, p4 )

How many cars, trucks, or vans are kept in your household?

#cars_household

ggplot(w2, aes(x = cars_household)) + geom_histogram(na.rm = TRUE, fill="#76d24a") + xlab("Number of cars, trucks or vans in household") +facet_grid(~ croise)

summary(w2$cars_household)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  1.0000  0.8752  1.0000  6.0000

Do you have access to a car kept outside of your household?

note: Participants could select multiple answers. This table shows the percentage of participants who selected each answer.

#cars_access_outside

# Create a vector with variable names
response = paste0("cars_access_outside_", 1:4)

# Empty vector to stor output
car_access_outside_prop <- c()

# Calculate univariate proportions
for(i in response){
  car_access_outside_prop[i] <- sum(w2[,i]) / nrow(w2)
}

# Transform
car_access_outside_prop <- as.data.frame(car_access_outside_prop)
car_access_outside_prop$Response <- c("Yes, I borrow a friend's or relative's car","Yes, I am a member of a car-sharing program (Communauto, Car2go, etc.) ","Yes, for another reason (Please specify)","No, I do not have access to a car kept outside of my household")

car_access_outside_prop$plot<- factor(car_access_outside_prop$Response, car_access_outside_prop$Response)

ggplot(car_access_outside_prop, aes(x = plot, y = car_access_outside_prop)) + geom_bar(stat = "identity", fill = "#76D24A") + xlab("") + ylab("Percentage of participants who selected this answer") + theme(axis.text.x  = element_text(size=12, angle=0, vjust=.6)) + scale_x_discrete(labels = function(plot) str_wrap(plot, width = 10))

car_access_outside_prop$car_access_outside_prop <- round(car_access_outside_prop$car_access_outside_prop*100,2)

#car_access_outside_prop <- setcolorder(car_access_outside_prop, c("Response", "car_access_outside_prop"))

colnames(car_access_outside_prop) <- c("Response", "Percentage of participants who selected this answer")

car_access_outside_prop <- car_access_outside_prop[-c(3)]
kable(car_access_outside_prop) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")  
Response Percentage of participants who selected this answer
cars_access_outside_1 12.65 Yes, I borrow a friend’s or relative’s car
cars_access_outside_2 22.30 Yes, I am a member of a car-sharing program (Communauto, Car2go, etc.)
cars_access_outside_3 6.49 Yes, for another reason (Please specify)
cars_access_outside_4 65.56 No, I do not have access to a car kept outside of my household

Do you currently have a valid driver’s license?

#license
var_name <- w2$license
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 511 85.02
No 90 14.98

Do you have access to a bicycle? Check all that apply.

note: Participants could select multiple answers. This table shows how frequently each answer was selected.

#bike_access_options

# Create a vector with variable names
response_bike = paste0("bike_access_options_", 1:5)

# Empty vector to stor output
bike_access_options_prop <- c()

# Calculate univariate proportions
for(i in response_bike){
  bike_access_options_prop[i] <- sum(w2[,i]) / nrow(w2)
}

# Transform
bike_access_options_prop <- as.data.frame(bike_access_options_prop)
bike_access_options_prop$Response <- c("No, I do not have access to a bicycle","Yes, I own a bicycle","Yes, I borrow a friend's or relative's bicycle","Yes, I use a bike share service (BIXI, Dropbike, etc.)", "Yes, I have access to a bicycle through another way (please specify)")


bike_access_options_prop$plot<- factor(bike_access_options_prop$Response, bike_access_options_prop$Response)

ggplot(bike_access_options_prop, aes(x = plot, y = bike_access_options_prop)) + geom_bar(stat = "identity", fill = "#76D24A") + xlab("") + ylab("Percentage of participants who selected this answer") + theme(axis.text.x  = element_text(size=10, angle=0, vjust=.6)) + scale_x_discrete(labels = function(plot) str_wrap(plot, width = 10))

bike_access_options_prop$bike_access_options_prop <- round(bike_access_options_prop$bike_access_options_prop*100,2)

#bike_access_options_prop <- setcolorder(bike_access_options_prop, c("Response", "bike_access_options_prop"))

colnames(bike_access_options_prop) <- c("Response", "Percentage of participants who selected this answer")

bike_access_options_prop <- bike_access_options_prop[-c(3)]
kable(bike_access_options_prop) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left") 
Response Percentage of participants who selected this answer
bike_access_options_1 19.80 No, I do not have access to a bicycle
bike_access_options_2 73.21 Yes, I own a bicycle
bike_access_options_3 1.66 Yes, I borrow a friend’s or relative’s bicycle
bike_access_options_4 14.98 Yes, I use a bike share service (BIXI, Dropbike, etc.)
bike_access_options_5 0.50 Yes, I have access to a bicycle through another way (please specify)

Section 2: Physical Activity

During the last 7 days, on how many days did you do vigorous physical activities like heavy lifting, digging, heavy construction, or climbing up stairs as part of your work? Think about only those physical activities that you did for at least 10 minutes at a time.

#work_vigpa

ggplot(w2, aes(x = work_vigpa)) + geom_histogram(na.rm = TRUE, fill = "#1596FF") + xlab("N days vigorous job-related physical activity") + facet_wrap(~ croise)

kable(data.frame(Days = 0:7, N = as.numeric(table(w2$work_vigpa)), Percentage = round(as.numeric(prop.table(table(w2$work_vigpa)))*100,2))) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Days N Percentage
0 489 81.36
1 24 3.99
2 22 3.66
3 24 3.99
4 10 1.66
5 21 3.49
6 2 0.33
7 9 1.50

How much time did you usually spend on one of those days doing vigorous physical activities as part of your work?

#work_vigpa_freq

w2$work_vigpa_freq[w2$work_vigpa_freq==-7] <- NA

ggplot(w2, aes(x = work_vigpa_freq)) + geom_histogram(na.rm = TRUE, binwidth = 20, fill= "#35AAC2") + xlab("Minutes vigorous job-related physical activity") + facet_wrap(~ croise)

summary(w2$work_vigpa_freq)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.00   20.00   60.00   96.21  120.00  720.00     489

During the last 7 days, on how many days did you travel in a motor vehicle like a train, bus, car, or metro?

#travel_motor

ggplot(w2, aes(x = w2$travel_motor)) + geom_histogram(na.rm = TRUE, fill="#1596FF") + xlab("N days") + facet_wrap(~ croise)

kable(data.frame(Days = 0:7, N = as.numeric(table(w2$travel_motor)), Percentage = round(as.numeric(prop.table(table(w2$travel_motor)))*100,2))) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Days N Percentage
0 107 17.80
1 94 15.64
2 113 18.80
3 73 12.15
4 61 10.15
5 70 11.65
6 28 4.66
7 55 9.15

How much time did you usually spend on one of those days travelling in a train, bus, car, metro, or other kind of motor vehicle?

#travel_motor_freq

w2$travel_motor_freq[w2$travel_motor_freq==-7] <- NA
ggplot(w2, aes(x = w2$travel_motor_freq)) + geom_histogram(na.rm = TRUE, binwidth = 20, fill= "#35AAC2") + xlab("Minutes travel time") + facet_wrap(~ croise)

summary(w2$travel_motor_freq)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     0.0    30.0    60.0    64.7    90.0   900.0     107

During the last 7 days, on how many days did you bicycle for at least 10 minutes at a time to go from place to place?

#travel_bike

ggplot(w2, aes(x = w2$travel_bike)) + geom_histogram(na.rm = TRUE, fill="#1596FF") + xlab("N days")+ facet_wrap(~ croise)

kable(data.frame(Days = 0:7, N = as.numeric(table(w2$travel_bike)), Percentage = round(as.numeric(prop.table(table(w2$travel_bike)))*100,2))) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Days N Percentage
0 418 69.55
1 43 7.15
2 41 6.82
3 25 4.16
4 21 3.49
5 26 4.33
6 9 1.50
7 18 3.00

How much time did you usually spend on one of those days to bicycle from place to place?

#travel_bike_freq

w2$travel_bike_freq[w2$travel_bike_freq==-7] <- NA
ggplot(w2, aes(x = w2$travel_bike_freq)) + geom_histogram(na.rm = TRUE, binwidth = 20, fill= "#35AAC2") + xlab("Minutes travel time") + facet_wrap(~ croise)

summary(w2$travel_bike_freq)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   10.00   30.00   45.00   58.14   60.00  360.00     418

During the last 7 days, on how many days did you walk for at least 10 minutes at a time to go from place to place?

#travel_walk

ggplot(w2, aes(x = w2$travel_walk)) + geom_histogram(na.rm = TRUE, fill="#1596FF") + xlab("# of days in the last 7 days")+ facet_wrap(~ croise)

kable(data.frame(Days = 0:7, N = as.numeric(table(w2$travel_walk)), Percentage = round(as.numeric(prop.table(table(w2$travel_walk)))*100,2))) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Days N Percentage
0 91 15.14
1 57 9.48
2 87 14.48
3 65 10.82
4 58 9.65
5 71 11.81
6 34 5.66
7 138 22.96

How much time did you usually spend on one of those days walking from place to place?

#travel_walk_freq

w2$travel_walk_freq[w2$travel_walk_freq==-7] <- NA

ggplot(w2, aes(x = w2$travel_walk_freq)) + geom_histogram(na.rm = TRUE, binwidth = 20, fill= "#35AAC2") + xlab("Minutes travel time") + facet_wrap(~ croise)

summary(w2$travel_walk_freq)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.00   20.00   30.00   44.32   60.00  420.00      91

Not counting any walking for transportation that you have already mentioned, during the last 7 days, on how many days did you walk for at least 10 minutes at a time in your leisure time?

#leisure_walk

ggplot(w2, aes(x = w2$leisure_walk)) + geom_histogram(na.rm = TRUE, fill="#1596FF") + xlab("N days")+ facet_wrap(~ croise)

kable(data.frame(Days = 0:7, N = as.numeric(table(w2$leisure_walk)), Percentage = round(as.numeric(prop.table(table(w2$leisure_walk))*100,2)))) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Days N Percentage
0 178 30
1 77 13
2 95 16
3 50 8
4 40 7
5 49 8
6 16 3
7 96 16

How much time did you usually spend on one of those days walking in your leisure time?

#leisure_walk_freq

w2$leisure_walk_freq[w2$leisure_walk_freq==-7] <- NA

ggplot(w2, aes(x = w2$leisure_walk_freq)) + geom_histogram(na.rm = TRUE, binwidth = 20, fill= "#35AAC2") + xlab("Minutes leisure time") + facet_wrap(~ croise)

summary(w2$leisure_walk_freq)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   10.00   30.00   45.00   53.88   60.00  480.00     178

Think about only those physical activities that you did for at least 10 minutes at a time, not counting any activity for transportation or work that you have already mentioned. During the last 7 days, on how many days did you do vigorous physical activities like aerobics, running, fast bicycling, or fast swimming in your leisure time?

#leisure_vigpa

ggplot(w2, aes(x = leisure_vigpa)) + geom_histogram(na.rm = TRUE, fill="#1596FF") + xlab("N days")+ facet_wrap(~ croise)

kable(data.frame(Days = 0:7, N = as.numeric(table(w2$leisure_vigpa)), Percentage = round(as.numeric(prop.table(table(w2$leisure_vigpa))*100,2)))) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Days N Percentage
0 357 59
1 47 8
2 48 8
3 62 10
4 39 6
5 26 4
6 16 3
7 6 1

How much time did you usually spend on one of those days doing vigorous physical activities in your leisure time?

#leisure_vigpa_freq

w2$leisure_vigpa_freq[w2$leisure_vigpa_freq==-7] <- NA

ggplot(w2, aes(x = leisure_vigpa_freq)) + geom_histogram(na.rm = TRUE, binwidth = 20, fill= "#35AAC2") + xlab("Minutes leisure time") 

summary(w2$leisure_vigpa_freq)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.00   30.00   47.50   65.29   60.00 1800.00     357

During the last 7 days, on how many days did you do moderate physical activities like bicycling at a regular pace, swimming at a regular pace, or doubles tennis in your leisure time?

#leisure_modpa

ggplot(w2, aes(x = leisure_modpa)) + geom_histogram(na.rm = TRUE, fill="#1596FF") + xlab("N days")+ facet_wrap(~ croise)

kable(data.frame(Days = 0:7, N = as.numeric(table(w2$leisure_modpa)), Percentage = round(as.numeric(prop.table(table(w2$leisure_modpa))*100,2)))) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Days N Percentage
0 406 68
1 70 12
2 45 7
3 35 6
4 14 2
5 17 3
6 6 1
7 8 1

How much time did you usually spend on one of those days doing moderate physical activities in your leisure time?

#leisure_modpa_freq

w2$leisure_modpa_freq[w2$leisure_modpa_freq==-7] <- NA

ggplot(w2, aes(x = w2$leisure_modpa_freq)) + geom_histogram(na.rm = TRUE, binwidth = 20, fill= "#35AAC2") + xlab("Minutes leisure time") + facet_wrap(~ croise)

summary(w2$leisure_modpa_freq)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     5.0    30.0    45.0    66.3    60.0   900.0     406

During the last 7 days, how much time did you usually spend sitting on a weekday?

#sit_weekday

ggplot(w2, aes(x = w2$sit_weekday/60)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill= "#35AAC2") + xlab("Hours sitting, weekday") + facet_wrap(~ croise)

summary(w2$sit_weekday)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     4.0   300.0   420.0   434.3   600.0   960.0

During the last 7 days, how much time did you usually spend sitting on a weekend day?

#sit_weekend

ggplot(w2, aes(x = w2$sit_weekend/60)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill= "#35AAC2") + xlab("Hours sitting, weekend") + facet_wrap(~ croise)

summary(w2$sit_weekend)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     0.0   180.0   300.0   326.2   420.0   960.0

Section 3: General Health

How tall are you?

#height

#exclude outliers?

ggplot(w2, aes(x = w2$height)) + geom_histogram(na.rm = TRUE, binwidth = 2, fill="#76D24A") + xlab("Height (cm)") + facet_wrap(~ croise)

summary(w2$height)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    28.0   163.0   168.0   168.2   175.0   193.0       4

How much do you weigh?

#weight

ggplot(w2, aes(x = w2$weight)) + geom_histogram(na.rm = TRUE, binwidth = 2, fill="#76D24A") + xlab("Weight (kg)") + facet_wrap(~ croise)

summary(w2$weight)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00   61.00   70.00   73.57   83.00  150.00

In general, would you say your health is:

#sf1

var_name <- w2$sf1
w2$var_name_f <- recode_factor(var_name, "1" = "Excellent", "2" = "Very good", "3" = "Good", "4" = "Fair", "5" = "Poor")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Excellent 94 15.64
Very good 244 40.60
Good 215 35.77
Fair 39 6.49
Poor 9 1.50

The following questions are about activities you might do during a typical day. Does your health now limit you in these activities? If so, how much?

a. Moderate activities such as moving a table, pushing a vacuum cleaner, bowling, or playing golf

var_name <- w2$sf2
w2$var_name_f <- recode_factor(var_name, "1" = "Yes, limited a lot",  "2" = "Yes, limited a little", "3" = "No, not at all")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes, limited a lot 16 2.66
Yes, limited a little 53 8.82
No, not at all 532 88.52

b. Climbing several flights of stairs

var_name <- w2$sf3
w2$var_name_f <- recode_factor(var_name, "1" = "Yes, limited a lot",  "2" = "Yes, limited a little", "3" = "No, not at all")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes, limited a lot 31 5.16
Yes, limited a little 100 16.64
No, not at all 470 78.20

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?

a. Accomplished less than you would like

#sf4 
var_name <- w2$sf4
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 130 21.63
No 471 78.37

b. Were limited in the kind of work or other activities

var_name <- w2$sf5
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 105 17.47
No 496 82.53

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)?

a. Accomplished less than you would like

var_name <- w2$sf6
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 243 40.43
No 358 59.57

b. Did work or activities less carefully than usual

var_name <- w2$sf7
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 186 30.95
No 415 69.05

During the past 4 weeks, how much did pain interfere with your normal work (including work outside the home and housework)?

var_name <- w2$sf8
w2$var_name_f <- recode_factor(var_name, "1" = "Not at all",  "2" = "Slightly", "3" = "Moderately", "4" =  "Quite a bit", "5" = "Extremely")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Not at all 332 55.24
Slightly 182 30.28
Moderately 51 8.49
Quite a bit 31 5.16
Extremely 5 0.83

How much of the time during the past 4 weeks.

a. Have you felt calm and peaceful?

var_name <- w2$sf9
w2$var_name_f <- recode_factor(var_name, "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")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
All of the time 47 7.82
Most of the time 185 30.78
A good bit of the time 217 36.11
Some of the time 105 17.47
A little of the time 39 6.49
None of the time 8 1.33

b. Did you have a lot of energy?

var_name <- w2$sf10
w2$var_name_f <- recode_factor(var_name, "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")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
All of the time 34 5.66
Most of the time 137 22.80
A good bit of the time 208 34.61
Some of the time 143 23.79
A little of the time 64 10.65
None of the time 15 2.50

c. Have you felt downhearted and blue?

var_name <- w2$sf11
w2$var_name_f <- recode_factor(var_name, "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")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
All of the time 6 1.00
Most of the time 46 7.65
A good bit of the time 66 10.98
Some of the time 188 31.28
A little of the time 196 32.61
None of the time 99 16.47

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.)?

var_name <- w2$sf12
w2$var_name_f <- recode_factor(var_name, "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")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
All of the time 5 0.83
Most of the time 22 3.66
A good bit of the time 50 8.32
Some of the time 94 15.64
A little of the time 150 24.96
None of the time 280 46.59

Section 4: Sleep

In the past month, when have you usually gone to bed?

#sleep_tq1

w2$sleep_tq1 <- as.POSIXct(w2$sleep_tq1,format="%H:%M:%S")
w2$sleep_tq1 <- hour(w2$sleep_tq1)

ggplot(w2, aes(x = sleep_tq1)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill="#76D24A") + xlab("Bed Time") + facet_grid(~ croise)

summary(w2$sleep_tq1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00   12.00   22.00   17.35   23.00   23.00

In the past month, how long (in minutes) has it taken you to fall asleep each night?

#sleep_tq2 in mins 

ggplot(w2, aes(x = sleep_tq2)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill="#76D24A") + xlab("Minutes to fall asleep") +facet_grid(~croise)

summary(w2$sleep_tq2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00   10.00   15.00   21.44   30.00  300.00

In the past month, when have you usually gotten up in the morning?

#sleep_tq3

w2$sleep_tq3 <- as.POSIXct(w2$sleep_tq3,format="%H:%M:%S")
w2$sleep_tq3 <- hour(w2$sleep_tq3)

ggplot(w2, aes(x = sleep_tq3)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill="#76D24A") + xlab("Wake Time") 

summary(w2$sleep_tq3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    6.00    7.00    7.03    8.00   23.00

During the past month, how would you rate your sleep quality overall?

#sleep_tq4

var_name <- w2$sleep_tq4
w2$var_name_f <- recode_factor(var_name, "1" = "Very good", "2" = "Fairly good", "3" = "Fairly bad", "4" = "Bad")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response")
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
var_name_f n pct
Very good 128 21.30
Fairly good 323 53.74
Fairly bad 132 21.96
Bad 18 3.00

How much do you typically sleep on

weeknights (Sunday to Thursday)? |hours

#sleep_c1
ggplot(w2, aes(x = sleep_c1)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill="#76D24A") + xlab("Hours")

summary(w2$sleep_c1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   7.000   7.500   7.402   8.000  16.000

weekend nights (Friday to Saturday)? |hours

#sleep_c2

ggplot(w2, aes(x = sleep_c2)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill="#76D24A") + xlab("Hours")

summary(w2$sleep_c2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   7.000   8.000   7.809   9.000  16.000

If I get less than _____ hours of sleep, I notice an impairment in my ability to function at work.

#sleep_c3
ggplot(w2, aes(x = sleep_c3)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill="#76D24A") + xlab("Hours")

summary(w2$sleep_c3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   5.500   6.000   6.304   7.000  11.000

During the past month, how often have you had trouble staying awake while driving, eating meals, or engaging in social activity?

#sleepiness
var_name <- w2$sleepiness
w2$var_name_f <- recode_factor(var_name, "0" = "Not during the past month", "1" = "Less than once a week", "2" = "Once or twice a week", "3" = "Three or more times a week")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response")
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
var_name_f n pct
Not during the past month 413 68.72
Less than once a week 132 21.96
Once or twice a week 40 6.66
Three or more times a week 16 2.66

Section 4: Well-being

Thinking about your own life and personal circumstances, how satisfied are you.

t_1 <- select(w2, croise, pwb_a, pwb_b, pwb_c, pwb_d, pwb_e, pwb_f, pwb_g, pwb_h, pwb_i)
t_1 <- pivot_longer(t_1,
   cols = starts_with("pwb_"),
   names_to = "perception",
   names_prefix = "pwb_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "a. With your life as a whole?"
t_1$perception[t_1$perception== "b"] <- "b. With your standard of living?"
t_1$perception[t_1$perception== "c"] <- "c. With your health?"
t_1$perception[t_1$perception== "d"] <- "d. With what you are achieving in life?"
t_1$perception[t_1$perception== "e"] <- "e. With your personal relationships?"
t_1$perception[t_1$perception== "f"] <- "f. With how safe you feel?"
t_1$perception[t_1$perception== "g"] <- "g. With feeling part of your community?"
t_1$perception[t_1$perception== "h"] <- "h. With your future security?"
t_1$perception[t_1$perception== "i"] <- "i. With your spirituality or religion?"

## recode

t_1$values <- recode_factor(t_1$values, "10" = "10- Completely satisfied", "9" = "9","8" = "8","7" = "7", "6" = "6", "5" = "5", "4" = "4", "3" = "3", "2" = "2", "1" = "1","0" = "0-Completely dissatisfied")

##### Table
t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACTPalettecont11) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

In general, I consider myself:

#gwb_a

var_name <- w2$gwb_a
w2$var_name_f <- recode_factor(var_name, "1" = "1- Not a very happy person", "2" = "2", "3" = "3", "4" = "4", "5" = "5", "6" = "6", "7" = "7- A very happy person")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1- Not a very happy person 3 0.50
2 7 1.16
3 21 3.49
4 47 7.82
5 143 23.79
6 255 42.43
7- A very happy person 125 20.80

Compared with most of my peers, I consider myself:

#gwb_b

var_name <- w2$gwb_b
w2$var_name_f <- recode_factor(var_name, "1" = "1- Less happy", "2" = "2", "3" = "3", "4" = "4", "5" = "5", "6" = "6", "7" = "7- More happy")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1- Less happy 7 1.16
2 16 2.66
3 27 4.49
4 79 13.14
5 161 26.79
6 195 32.45
7- More happy 116 19.30

Some people are generally very happy. They enjoy life regardless of what is going on, getting the most out of everything. To what extent does this characterization describe you?

#gwb_c

var_name <- w2$gwb_c
w2$var_name_f <- recode_factor(var_name, "1" = "1- Not at all", "2" = "2", "3" = "3", "4" = "4", "5" = "5", "6" = "6", "7" = "7- A great deal")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1- Not at all 19 3.16
2 27 4.49
3 52 8.65
4 75 12.48
5 133 22.13
6 189 31.45
7- A great deal 106 17.64

Some people are generally not very happy. Although they are not depressed, they never seem as happy as they might be. To what extent does this characterization describe you?

#gwb_d
var_name <- w2$gwb_d
w2$var_name_f <- recode_factor(var_name, "1" = "1- Not at all","2" = "2", "3" = "3", "4" = "4", "5" = "5", "6" = "6",  "7" = "7- A great deal")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1- Not at all 201 33.44
2 142 23.63
3 71 11.81
4 49 8.15
5 70 11.65
6 52 8.65
7- A great deal 16 2.66

Tell us how often you feel this way.

t_1 <- select(w2, croise, loneliness_a, loneliness_b, loneliness_c)
t_1 <- pivot_longer(t_1,
   cols = starts_with("loneliness_"),
   names_to = "perception",
   names_prefix = "loneliness_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "a. How often do you feel that you lack companionship?"
t_1$perception[t_1$perception== "b"] <- "b. How often do you feel left out?"
t_1$perception[t_1$perception== "c"] <- "c. How often do you feel isolated from others?"


## recode

t_1$values <- recode_factor(t_1$values, "1" = "Hardly ever", "2" = "Some of the time", "3" = "Often")

##### Table
t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = rev(INTERACTshorterfade3)) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

Section 5: Social Participation

How would you describe your sense of belonging to your local community? Would you say it is:

var_name <- w2$belonging
w2$var_name_f <- recode_factor(var_name, "1" = "Very strong", "2" = "Somewhat strong", "3" = "Somewhat weak", "4" = "Very weak", "77" ="I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very strong 43 7.15
Somewhat strong 267 44.43
Somewhat weak 182 30.28
Very weak 79 13.14
I don’t know 30 4.99

How often do you.

a. Say hello to a neighbour?

#spat_a

#per week
ggplot(w2, aes(x = w2$spat_a/52.1429)) + 
  geom_histogram(binwidth = 1, na.rm = TRUE, fill="#1596FF") + xlab("Times per week") + facet_wrap( ~ croise)

summary(w2$spat_a/52.1429)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.9973  2.9918  3.2625  4.9863  7.0000

b. Stop and have a chat with a neighbour?

#spat_b

#per week
ggplot(w2, aes(x = w2$spat_b/52.1429)) + 
  geom_histogram(binwidth = 1, na.rm = TRUE, fill="#1596FF") + xlab("Times per week")+ facet_wrap( ~ croise)

summary(w2$spat_b/52.1429)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.2301  0.9973  1.6929  2.9918  7.0000

c. Visit a neighbour, or receive a visit from a neighbour?

#spat_c

#per week
ggplot(w2, aes(x = w2$spat_c/52.1429)) + 
  geom_histogram(binwidth = 1, na.rm = TRUE, fill="#1596FF") + xlab("Times per week")+ facet_wrap( ~ croise)

summary(w2$spat_c/52.1429)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.4581  0.2301  6.9808

d. Go somewhere (e.g., to a shop; to a restaurant), together with a neighbour?

#spat_d

#per week
ggplot(w2, aes(x = w2$spat_d/52.1429)) + 
  geom_histogram(binwidth = 1, na.rm = TRUE, fill="#1596FF") + xlab("Times per week")+ facet_wrap( ~ croise)

summary(w2$spat_d/52.1429)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.1785  0.0000  6.9808

e. Ask help/advice from or do you help/give advice to a neighbour yourself?

#spat_e

#per week
ggplot(w2, aes(x = w2$spat_e/52.1429)) + 
  geom_histogram(binwidth = 1, na.rm = TRUE, fill="#1596FF") + xlab("Times per week")+ facet_wrap( ~ croise)

summary(w2$spat_e/52.1429)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.00000 0.00000 0.03836 0.36553 0.23014 6.98082

Thinking about your neighbourhood, how would you rate the following statements?

a. This is a close-knit neighbourhood

# plot spat2_a

var_name <- w2$spat2_a
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 51 8.49
Somewhat disagree 99 16.47
Neither agree or disagree 252 41.93
Somewhat agree 152 25.29
Strongly agree 47 7.82

b. People generally do not get along

# plot spat2_b
var_name <- w2$spat2_b
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 173 28.79
Somewhat disagree 199 33.11
Neither agree or disagree 176 29.28
Somewhat agree 41 6.82
Strongly agree 12 2.00

c. People are willing to help neighbours

# plot spat2_c
var_name <- w2$spat2_c
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 11 1.83
Somewhat disagree 52 8.65
Neither agree or disagree 179 29.78
Somewhat agree 268 44.59
Strongly agree 91 15.14

d. People do not share same values

var_name <- w2$spat2_d
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 83 13.81
Somewhat disagree 186 30.95
Neither agree or disagree 249 41.43
Somewhat agree 58 9.65
Strongly agree 25 4.16

e. People can be trusted

# plot spat2_e

var_name <- w2$spat2_e
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 17 2.83
Somewhat disagree 45 7.49
Neither agree or disagree 164 27.29
Somewhat agree 281 46.76
Strongly agree 94 15.64

If you lost a wallet or purse that contained two hundred dollars, how likely is it to be returned with the money in it, if it was found:

a. By someone who lives close by? Would it be:

#spat3_a
var_name <- w2$spat3_a
w2$var_name_f <- recode_factor(var_name, "1"="Very likely", "2"="Somewhat likely", "3"="Not at all likely", "77"="I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very likely 231 38.44
Somewhat likely 259 43.09
Not at all likely 59 9.82
I don’t know 52 8.65

b. By a complete stranger? Would it be:

#spat3_b
var_name <- w2$spat3_b
w2$var_name_f <- recode_factor(var_name, "1"="Very likely", "2"="Somewhat likely", "3"="Not at all likely", "77"="I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very likely 12 2.00
Somewhat likely 128 21.30
Not at all likely 340 56.57
I don’t know 121 20.13

How many close friends do you have (that is, people who are not your relatives, but who you feel at ease with, can talk to about what is on your mind, or call on for help)?

#confide

ggplot(w2, aes(x = w2$confide)) + 
  geom_histogram(binwidth = 1, na.rm = TRUE, fill="#1596FF") + xlab("Friends")+ facet_wrap( ~ croise)

summary(w2$confide)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   3.000   5.000   6.015   8.000  50.000

Here are some questions about your satisfaction with the neighbourhood in which you live. Please indicate your satisfaction with each item.How satisfied are you with…

a. your neighbourhood as a good place to live?

#neighb_a

var_name <- w2$neighb_a
w2$var_name_f <- recode_factor(var_name, "1" = "Strongly satisfied", "2" = "Satisfied", "3" = "Neither satisfied nor dissatisfied", "4" = "Dissatisfied", "5" = "Strongly dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly satisfied 272 45.26
Satisfied 255 42.43
Neither satisfied nor dissatisfied 44 7.32
Dissatisfied 24 3.99
Strongly dissatisfied 6 1.00

b. the number of people you know in your neighbourhood?

#neighb_b
var_name <- w2$neighb_b
w2$var_name_f <- recode_factor(var_name, "1" = "Strongly satisfied", "2" = "Satisfied", "3" = "Neither satisfied nor dissatisfied", "4" = "Dissatisfied", "5" = "Strongly dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly satisfied 106 17.64
Satisfied 229 38.10
Neither satisfied nor dissatisfied 181 30.12
Dissatisfied 78 12.98
Strongly dissatisfied 7 1.16

c. the ethnic diversity of your neighbourhood?

#neighb_c
var_name <- w2$neighb_c
w2$var_name_f <- recode_factor(var_name, "1" = "Strongly satisfied", "2" = "Satisfied", "3" = "Neither satisfied nor dissatisfied", "4" = "Dissatisfied", "5" = "Strongly dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly satisfied 112 18.64
Satisfied 226 37.60
Neither satisfied nor dissatisfied 212 35.27
Dissatisfied 46 7.65
Strongly dissatisfied 5 0.83

d. your neighbourhood as a good place to raise children

#neighb_d

var_name <- w2$neighb_d
w2$var_name_f <- recode_factor(var_name, "1" = "Strongly satisfied", "2" = "Satisfied", "3" = "Neither satisfied nor dissatisfied", "4" = "Dissatisfied", "5" = "Strongly dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly satisfied 213 35.44
Satisfied 226 37.60
Neither satisfied nor dissatisfied 120 19.97
Dissatisfied 26 4.33
Strongly dissatisfied 16 2.66

To what extent do you agree with the following statements?

a. People feel that neighbourhood efforts to improve this area are a waste of time.

#rds_a

var_name <- w2$rds_a
w2$var_name_f <- recode_factor(var_name, "1" = "1 - Strongly disagree",  "2" = "2", "3" = "3", "4" = "4", "5" = "5", "6" = "6",  "7" = "7", "8" = "8", "9" = "9","10" = "10 - Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTfade)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1 - Strongly disagree 110 18.30
2 74 12.31
3 132 21.96
4 74 12.31
5 98 16.31
6 43 7.15
7 29 4.83
8 21 3.49
9 9 1.50
10 - Strongly agree 11 1.83

b. When something needs to be improved in the neighbourhood, people from outside the neighbourhood are more likely to do something about it than people from inside the neighbourhood.

var_name <- w2$rds_b
w2$var_name_f <- recode_factor(var_name, "1" = "1 - Strongly disagree", "2" = "2", "3" = "3", "4" = "4", "5" = "5", "6" = "6",  "7" = "7", "8" = "8", "9" = "9", "10" = "10 - Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTfade)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1 - Strongly disagree 114 18.97
2 93 15.47
3 121 20.13
4 51 8.49
5 119 19.80
6 36 5.99
7 22 3.66
8 19 3.16
9 13 2.16
10 - Strongly agree 13 2.16

c. The people in this neighbourhood have almost no influence over what happens here.

var_name <- w2$rds_c
w2$var_name_f <- recode_factor(var_name, "1" = "1 - Strongly disagree", "2" = "2", "3" = "3", "4" = "4", "5" = "5", "6" = "6",  "7" = "7", "8" = "8", "9" = "9", "10" = "10 - Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTfade)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1 - Strongly disagree 80 13.31
2 70 11.65
3 119 19.80
4 84 13.98
5 104 17.30
6 43 7.15
7 29 4.83
8 34 5.66
9 13 2.16
10 - Strongly agree 25 4.16

To what extent do you agree with the following statements?

I can get what I need in this neighbourhood

#sci_a

var_name <- w2$sci_a
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 14 2.33
Somewhat disagree 58 9.65
Neither agree or disagree 79 13.14
Somewhat agree 247 41.10
Strongly agree 203 33.78

This neighbourhood helps me fulfill my needs

var_name <- w2$sci_b
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 14 2.33
Somewhat disagree 37 6.16
Neither agree or disagree 97 16.14
Somewhat agree 257 42.76
Strongly agree 196 32.61

I feel like a member of this neighbourhood

var_name <- w2$sci_c
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 31 5.16
Somewhat disagree 47 7.82
Neither agree or disagree 165 27.45
Somewhat agree 207 34.44
Strongly agree 151 25.12

I belong in this neighbourhood

var_name <- w2$sci_d
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 30 4.99
Somewhat disagree 41 6.82
Neither agree or disagree 144 23.96
Somewhat agree 217 36.11
Strongly agree 169 28.12

I have a say about what goes on in my neighbourhood

var_name <- w2$sci_e
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 52 8.65
Somewhat disagree 110 18.30
Neither agree or disagree 217 36.11
Somewhat agree 159 26.46
Strongly agree 63 10.48

People in this neighbourhood are good at influencing each other

var_name <- w2$sci_f
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 25 4.16
Somewhat disagree 81 13.48
Neither agree or disagree 306 50.92
Somewhat agree 148 24.63
Strongly agree 41 6.82

I feel connected to this neighbourhood

var_name <- w2$sci_g
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 28 4.66
Somewhat disagree 57 9.48
Neither agree or disagree 108 17.97
Somewhat agree 212 35.27
Strongly agree 196 32.61

I have a good bond with others in this neighbourhood

var_name <- w2$sci_h
w2$var_name_f <- recode_factor(var_name, "1"="Strongly disagree", "2"="Somewhat disagree", "3"="Neither agree or disagree", "4"="Somewhat agree", "5"= "Strongly agree")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalette3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Strongly disagree 13 2.16
Somewhat disagree 39 6.49
Neither agree or disagree 162 26.96
Somewhat agree 250 41.60
Strongly agree 137 22.80

Section 6: Neighbourhood Perception

In recent years, the urban environment of my neighbourhood has

#change_urbenv

var_name <- w2$change_urbenv
w2$var_name_f <- recode_factor(var_name, "1"="Gotten much better", "2"="Gotten a bit better", "3"="Stayed the same", "4"="Gotten a bit worse", "5"= "Gotten much worse")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Gotten much better 134 22.30
Gotten a bit better 290 48.25
Stayed the same 113 18.80
Gotten a bit worse 45 7.49
Gotten much worse 19 3.16

To what extent do you agree or disagree with these statements. In my neighbourhood.

positive items

## POSITIVE ITEMS 


pos <- select(w2, croise, feat_urbenv_b,feat_urbenv_d, feat_urbenv_f, feat_urbenv_g, feat_urbenv_h, feat_urbenv_j, feat_urbenv_l, feat_urbenv_m, feat_urbenv_o)
pos <- pivot_longer(pos,
   cols = starts_with("feat_urbenv_"),
   names_to = "feature",
   names_prefix = "feat_urbenv_",
   values_to = "values",
   values_drop_na = TRUE)

pos$values <- recode_factor(pos$values, "1" = "1. Completely agree", "2" = "2", "3" = "3" , "4" = "4. Completely disagree", "77" = "I don't know")

## rename 
pos$feature[pos$feature== "a"] <- "a. Parking is difficult in local shopping areas"
pos$feature[pos$feature== "b"] <- "b. Car traffic moves fluidly and efficiently"
pos$feature[pos$feature== "c"] <- "c. Streets can be excessively noisy"
pos$feature[pos$feature== "d"] <- "d. The sidewalks are in good condition"
pos$feature[pos$feature== "e"] <- "e. The sidewalks are not wide enough"
pos$feature[pos$feature== "f"] <- "f. There are enough trees along the street"
pos$feature[pos$feature== "g"] <- "g. There are many public spaces where people can relax and socialize (placottoirs, plazas, street seating, etc.)"
pos$feature[pos$feature== "h"] <- "h. Shops and services are easily accessible"
pos$feature[pos$feature== "i"] <- "i. There are no urban furnishings like benches or bike parking"
pos$feature[pos$feature== "j"] <- "j. There are sufficient public transit options nearby"
pos$feature[pos$feature== "k"] <- "k. The air is polluted"
pos$feature[pos$feature== "l"] <- "l. There are many parks nearby"
pos$feature[pos$feature== "m"] <- "m. There are lots of greened spaces, with features like trees, planters, green buffers between the road and the sidewalk."
pos$feature[pos$feature== "n"] <- "n. It is especially dangerous to bike on the street"
pos$feature[pos$feature== "o"] <- "o. There is a connected network of bike paths"


pos <- pos %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(pos, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 


plot(p)

kable(pos)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
  1. Car traffic moves fluidly and efficiently
  1. Completely agree
115 19.13
  1. Car traffic moves fluidly and efficiently
2 223 37.10
  1. Car traffic moves fluidly and efficiently
3 186 30.95
  1. Car traffic moves fluidly and efficiently
  1. Completely disagree
77 12.81
  1. The sidewalks are in good condition
  1. Completely agree
140 23.29
  1. The sidewalks are in good condition
2 250 41.60
  1. The sidewalks are in good condition
3 148 24.63
  1. The sidewalks are in good condition
  1. Completely disagree
63 10.48
  1. There are enough trees along the street
  1. Completely agree
146 24.29
  1. There are enough trees along the street
2 192 31.95
  1. There are enough trees along the street
3 175 29.12
  1. There are enough trees along the street
  1. Completely disagree
88 14.64
  1. There are many public spaces where people can relax and socialize (placottoirs, plazas, street seating, etc.)
  1. Completely agree
177 29.45
  1. There are many public spaces where people can relax and socialize (placottoirs, plazas, street seating, etc.)
2 233 38.77
  1. There are many public spaces where people can relax and socialize (placottoirs, plazas, street seating, etc.)
3 139 23.13
  1. There are many public spaces where people can relax and socialize (placottoirs, plazas, street seating, etc.)
  1. Completely disagree
52 8.65
  1. Shops and services are easily accessible
  1. Completely agree
296 49.25
  1. Shops and services are easily accessible
2 207 34.44
  1. Shops and services are easily accessible
3 69 11.48
  1. Shops and services are easily accessible
  1. Completely disagree
29 4.83
  1. There are sufficient public transit options nearby
  1. Completely agree
298 49.58
  1. There are sufficient public transit options nearby
2 175 29.12
  1. There are sufficient public transit options nearby
3 79 13.14
  1. There are sufficient public transit options nearby
  1. Completely disagree
49 8.15
  1. There are many parks nearby
  1. Completely agree
338 56.24
  1. There are many parks nearby
2 208 34.61
  1. There are many parks nearby
3 44 7.32
  1. There are many parks nearby
  1. Completely disagree
11 1.83
  1. There are lots of greened spaces, with features like trees, planters, green buffers between the road and the sidewalk.
  1. Completely agree
209 34.78
  1. There are lots of greened spaces, with features like trees, planters, green buffers between the road and the sidewalk.
2 226 37.60
  1. There are lots of greened spaces, with features like trees, planters, green buffers between the road and the sidewalk.
3 121 20.13
  1. There are lots of greened spaces, with features like trees, planters, green buffers between the road and the sidewalk.
  1. Completely disagree
45 7.49
  1. There is a connected network of bike paths
  1. Completely agree
239 39.77
  1. There is a connected network of bike paths
2 222 36.94
  1. There is a connected network of bike paths
3 93 15.47
  1. There is a connected network of bike paths
  1. Completely disagree
47 7.82

negative items

neg <- select(w2, croise, feat_urbenv_a,feat_urbenv_c, feat_urbenv_e, feat_urbenv_i, feat_urbenv_k, feat_urbenv_n)
neg <- pivot_longer(neg,
   cols = starts_with("feat_urbenv_"),
   names_to = "feature",
   names_prefix = "feat_urbenv_",
   values_to = "values",
   values_drop_na = TRUE)

neg$values <- recode_factor(neg$values, "1" = "1. Completely agree", "2" = "2", "3" = "3" , "4" = "4. Completely disagree", "77" = "I don't know")


## rename 
neg$feature[neg$feature== "a"] <- "a. Parking is difficult in local shopping areas"
neg$feature[neg$feature== "c"] <- "c. Streets can be excessively noisy"
neg$feature[neg$feature== "e"] <- "e. The sidewalks are not wide enough"
neg$feature[neg$feature== "i"] <- "i. There are no urban furnishings like benches or bike parking"
neg$feature[neg$feature== "k"] <- "k. The air is polluted"
neg$feature[neg$feature== "n"] <- "n. It is especially dangerous to bike on the street"


neg <- neg %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(neg, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 


plot(p)

kable(neg)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
  1. Parking is difficult in local shopping areas
  1. Completely agree
98 16.31
  1. Parking is difficult in local shopping areas
2 164 27.29
  1. Parking is difficult in local shopping areas
3 170 28.29
  1. Parking is difficult in local shopping areas
  1. Completely disagree
169 28.12
  1. Streets can be excessively noisy
  1. Completely agree
99 16.47
  1. Streets can be excessively noisy
2 226 37.60
  1. Streets can be excessively noisy
3 189 31.45
  1. Streets can be excessively noisy
  1. Completely disagree
87 14.48
  1. The sidewalks are not wide enough
  1. Completely agree
107 17.80
  1. The sidewalks are not wide enough
2 190 31.61
  1. The sidewalks are not wide enough
3 198 32.95
  1. The sidewalks are not wide enough
  1. Completely disagree
106 17.64
  1. There are no urban furnishings like benches or bike parking
  1. Completely agree
41 6.82
  1. There are no urban furnishings like benches or bike parking
2 159 26.46
  1. There are no urban furnishings like benches or bike parking
3 234 38.94
  1. There are no urban furnishings like benches or bike parking
  1. Completely disagree
167 27.79
  1. The air is polluted
  1. Completely agree
71 11.81
  1. The air is polluted
2 215 35.77
  1. The air is polluted
3 215 35.77
  1. The air is polluted
  1. Completely disagree
100 16.64
  1. It is especially dangerous to bike on the street
  1. Completely agree
59 9.82
  1. It is especially dangerous to bike on the street
2 187 31.11
  1. It is especially dangerous to bike on the street
3 240 39.93
  1. It is especially dangerous to bike on the street
  1. Completely disagree
115 19.13

To what extent do you agree or disagree with the following statements? In my neighbourhood, there are more and more.

#increase_urbenv_a

t_1 <- select(w2, croise, increase_urbenv_a,increase_urbenv_b, increase_urbenv_c, increase_urbenv_d, increase_urbenv_e, increase_urbenv_f, increase_urbenv_g)
t_1 <- pivot_longer(t_1,
   cols = starts_with("increase_urbenv_"),
   names_to = "feature",
   names_prefix = "increase_urbenv_",
   values_to = "values",
   values_drop_na = TRUE)

t_1$values <- recode_factor(t_1$values, "1" = "1. Completely agree", "2" = "2", "3" = "3" , "4" = "4. Completely disagree", "77" = "I don't know")


## rename 
t_1$feature[t_1$feature== "a"] <- "a. Bike paths"
t_1$feature[t_1$feature== "b"] <- "b. Pedestrian-friendly designs, like wider sidewalks, speed-bumps, and stop signs"
t_1$feature[t_1$feature== "c"] <- "c. Potholes"
t_1$feature[t_1$feature== "d"] <- "d. Green alleys (ruelles vertes)"
t_1$feature[t_1$feature== "e"] <- "e. Greened spaces featuring trees, gardens, and planters"
t_1$feature[t_1$feature== "f"] <- "f. Graffiti"
t_1$feature[t_1$feature== "g"] <- "g. Pedestrianized streets"


t_1 <- t_1 %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 


plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
  1. Bike paths
  1. Completely agree
288 47.92
  1. Bike paths
2 191 31.78
  1. Bike paths
3 76 12.65
  1. Bike paths
  1. Completely disagree
46 7.65
  1. Pedestrian-friendly designs, like wider sidewalks, speed-bumps, and stop signs
  1. Completely agree
202 33.61
  1. Pedestrian-friendly designs, like wider sidewalks, speed-bumps, and stop signs
2 238 39.60
  1. Pedestrian-friendly designs, like wider sidewalks, speed-bumps, and stop signs
3 116 19.30
  1. Pedestrian-friendly designs, like wider sidewalks, speed-bumps, and stop signs
  1. Completely disagree
45 7.49
  1. Potholes
  1. Completely agree
152 25.29
  1. Potholes
2 241 40.10
  1. Potholes
3 188 31.28
  1. Potholes
  1. Completely disagree
20 3.33
  1. Green alleys (ruelles vertes)
  1. Completely agree
109 18.14
  1. Green alleys (ruelles vertes)
2 196 32.61
  1. Green alleys (ruelles vertes)
3 172 28.62
  1. Green alleys (ruelles vertes)
  1. Completely disagree
124 20.63
  1. Greened spaces featuring trees, gardens, and planters
  1. Completely agree
137 22.80
  1. Greened spaces featuring trees, gardens, and planters
2 276 45.92
  1. Greened spaces featuring trees, gardens, and planters
3 134 22.30
  1. Greened spaces featuring trees, gardens, and planters
  1. Completely disagree
54 8.99
  1. Graffiti
  1. Completely agree
79 13.14
  1. Graffiti
2 166 27.62
  1. Graffiti
3 253 42.10
  1. Graffiti
  1. Completely disagree
103 17.14
  1. Pedestrianized streets
  1. Completely agree
69 11.48
  1. Pedestrianized streets
2 159 26.46
  1. Pedestrianized streets
3 153 25.46
  1. Pedestrianized streets
  1. Completely disagree
220 36.61

To what extent do you agree or disagree with the following statements?

#changeeffects_urbenv

t_1 <- select(w2, croise, changeeffects_urbenv_a,changeeffects_urbenv_b, changeeffects_urbenv_c, changeeffects_urbenv_d, changeeffects_urbenv_e)
t_1 <- pivot_longer(t_1,
   cols = starts_with("changeeffects_urbenv_"),
   names_to = "feature",
   names_prefix = "changeeffects_urbenv_",
   values_to = "values",
   values_drop_na = TRUE)

t_1$values <- recode_factor(t_1$values, "1" = "1. Completely agree", "2" = "2", "3" = "3" , "4" = "4. Completely disagree", "77" = "I don't know")


## rename 
t_1$feature[t_1$feature== "a"] <- "a. The City is investing in my neighbourhood"
t_1$feature[t_1$feature== "b"] <- "b. The changes in my neighbourhood are improving my quality of life"
t_1$feature[t_1$feature== "c"] <- "c. My neighbourhood is more and more dynamic"
t_1$feature[t_1$feature== "d"] <- "d. Low-income people can't afford to stay in this neighbourhood"
t_1$feature[t_1$feature== "e"] <- "e. I feel more and more anonymous in my neighbourhood"

t_1 <- t_1 %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 


plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
  1. The City is investing in my neighbourhood
  1. Completely agree
140 23.29
  1. The City is investing in my neighbourhood
2 327 54.41
  1. The City is investing in my neighbourhood
3 78 12.98
  1. The City is investing in my neighbourhood
  1. Completely disagree
40 6.66
  1. The City is investing in my neighbourhood
I don’t know 16 2.66
  1. The changes in my neighbourhood are improving my quality of life
  1. Completely agree
196 32.61
  1. The changes in my neighbourhood are improving my quality of life
2 263 43.76
  1. The changes in my neighbourhood are improving my quality of life
3 61 10.15
  1. The changes in my neighbourhood are improving my quality of life
  1. Completely disagree
49 8.15
  1. The changes in my neighbourhood are improving my quality of life
I don’t know 32 5.32
  1. My neighbourhood is more and more dynamic
  1. Completely agree
147 24.46
  1. My neighbourhood is more and more dynamic
2 263 43.76
  1. My neighbourhood is more and more dynamic
3 117 19.47
  1. My neighbourhood is more and more dynamic
  1. Completely disagree
48 7.99
  1. My neighbourhood is more and more dynamic
I don’t know 26 4.33
  1. Low-income people can’t afford to stay in this neighbourhood
  1. Completely agree
233 38.77
  1. Low-income people can’t afford to stay in this neighbourhood
2 198 32.95
  1. Low-income people can’t afford to stay in this neighbourhood
3 103 17.14
  1. Low-income people can’t afford to stay in this neighbourhood
  1. Completely disagree
46 7.65
  1. Low-income people can’t afford to stay in this neighbourhood
I don’t know 21 3.49
  1. I feel more and more anonymous in my neighbourhood
  1. Completely agree
38 6.32
  1. I feel more and more anonymous in my neighbourhood
2 134 22.30
  1. I feel more and more anonymous in my neighbourhood
3 247 41.10
  1. I feel more and more anonymous in my neighbourhood
  1. Completely disagree
120 19.97
  1. I feel more and more anonymous in my neighbourhood
I don’t know 62 10.32

To what extent do you agree or disagree with the following statements? The changes in my neighbourhood are making it easier for me to get around:

  1. By foot
  2. By bike
  3. By car
  4. By transit
#changeeffects_urbenv_trans
w2$changeeffects_urbenv_trans_a[w2$changeeffects_urbenv_trans_a==-7] <- NA
w2$changeeffects_urbenv_trans_b[w2$changeeffects_urbenv_trans_b==-7] <- NA
w2$changeeffects_urbenv_trans_c[w2$changeeffects_urbenv_trans_c==-7] <- NA
w2$changeeffects_urbenv_trans_d[w2$changeeffects_urbenv_trans_d==-7] <- NA


t_1 <- select(w2, croise, changeeffects_urbenv_trans_a,changeeffects_urbenv_trans_b, changeeffects_urbenv_trans_c, changeeffects_urbenv_trans_d)
t_1 <- pivot_longer(t_1,
   cols = starts_with("changeeffects_urbenv_trans_"),
   names_to = "feature",
   names_prefix = "changeeffects_urbenv_trans_",
   values_to = "values",
   values_drop_na = TRUE)

t_1$values <- recode_factor(t_1$values, "1" = "1. Completely agree", "2" = "2", "3" = "3" , "4" = "4. Completely disagree", "77" = "I don't know")


## rename 
t_1$feature[t_1$feature== "a"] <- "By foot"
t_1$feature[t_1$feature== "b"] <- "By bike"
t_1$feature[t_1$feature== "c"] <- "By car"
t_1$feature[t_1$feature== "d"] <- "By transit"

t_1 <- t_1 %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT4likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 


plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
By bike
  1. Completely agree
228 46.72
By bike 2 176 36.07
By bike 3 61 12.50
By bike
  1. Completely disagree
23 4.71
By car
  1. Completely agree
44 9.02
By car 2 117 23.98
By car 3 249 51.02
By car
  1. Completely disagree
78 15.98
By foot
  1. Completely agree
197 40.37
By foot 2 199 40.78
By foot 3 67 13.73
By foot
  1. Completely disagree
25 5.12
By transit
  1. Completely agree
91 18.65
By transit 2 222 45.49
By transit 3 140 28.69
By transit
  1. Completely disagree
35 7.17

Section 7: PACER questions

Thinking about changes in your neighbourhood, please identify the degree to which the following changes have happened.

# pacer_typechange_a

INTERACT3likert <- c("#1596ff",  "#EBF0F8", "#76D24A"  , "#666666")

t_1 <- select(w2, croise, pacer_typechange_a, pacer_typechange_b, pacer_typechange_c, pacer_typechange_d, pacer_typechange_e, pacer_typechange_f, pacer_typechange_g, pacer_typechange_h, pacer_typechange_i)
t_1 <- pivot_longer(t_1,
   cols = starts_with("pacer_typechange_"),
   names_to = "feature",
   names_prefix = "pacer_typechange_",
   values_to = "values",
   values_drop_na = TRUE)

t_1$values <- recode_factor(t_1$values, "1"="Not happening", "2"="Happening a little", "3"="Happening a lot", "77"="I don't know")


## rename 
t_1$feature[t_1$feature== "a"] <- "New businesses are opening"
t_1$feature[t_1$feature== "b"] <- "Long-standing businesses are being replaced by different businesses."
t_1$feature[t_1$feature== "c"] <- "More expensive or fancier grocery stores are opening"
t_1$feature[t_1$feature== "d"] <- "The cost of housing have increased (i.e. renting or buying) "
t_1$feature[t_1$feature== "e"] <- "The costs of necessary expenses other than housing have increased (e.g., childcare; groceries; transit)"
t_1$feature[t_1$feature== "f"] <- "Construction of new buildings on vacant lots or to replace old buildings"
t_1$feature[t_1$feature== "g"] <- "Construction of new or improved resources, such as parks, bike lanes, transit, or sidewalks"
t_1$feature[t_1$feature== "h"] <- "People are “flipping” properties, buying and fixing them up to rent or sell."
t_1$feature[t_1$feature== "i"] <- "Changes are leading to tension or conflict between me and my neighbours"


t_1 <- t_1 %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT3likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 


plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
Changes are leading to tension or conflict between me and my neighbours Not happening 323 53.74
Changes are leading to tension or conflict between me and my neighbours Happening a little 119 19.80
Changes are leading to tension or conflict between me and my neighbours Happening a lot 32 5.32
Changes are leading to tension or conflict between me and my neighbours I don’t know 127 21.13
Construction of new buildings on vacant lots or to replace old buildings Not happening 85 14.14
Construction of new buildings on vacant lots or to replace old buildings Happening a little 218 36.27
Construction of new buildings on vacant lots or to replace old buildings Happening a lot 243 40.43
Construction of new buildings on vacant lots or to replace old buildings I don’t know 55 9.15
Construction of new or improved resources, such as parks, bike lanes, transit, or sidewalks Not happening 107 17.80
Construction of new or improved resources, such as parks, bike lanes, transit, or sidewalks Happening a little 304 50.58
Construction of new or improved resources, such as parks, bike lanes, transit, or sidewalks Happening a lot 164 27.29
Construction of new or improved resources, such as parks, bike lanes, transit, or sidewalks I don’t know 26 4.33
Long-standing businesses are being replaced by different businesses. Not happening 126 20.97
Long-standing businesses are being replaced by different businesses. Happening a little 317 52.75
Long-standing businesses are being replaced by different businesses. Happening a lot 84 13.98
Long-standing businesses are being replaced by different businesses. I don’t know 74 12.31
More expensive or fancier grocery stores are opening Not happening 239 39.77
More expensive or fancier grocery stores are opening Happening a little 231 38.44
More expensive or fancier grocery stores are opening Happening a lot 87 14.48
More expensive or fancier grocery stores are opening I don’t know 44 7.32
New businesses are opening Not happening 156 25.96
New businesses are opening Happening a little 310 51.58
New businesses are opening Happening a lot 101 16.81
New businesses are opening I don’t know 34 5.66
People are “flipping” properties, buying and fixing them up to rent or sell. Not happening 84 13.98
People are “flipping” properties, buying and fixing them up to rent or sell. Happening a little 171 28.45
People are “flipping” properties, buying and fixing them up to rent or sell. Happening a lot 198 32.95
People are “flipping” properties, buying and fixing them up to rent or sell. I don’t know 148 24.63
The cost of housing have increased (i.e. renting or buying) Not happening 15 2.50
The cost of housing have increased (i.e. renting or buying) Happening a little 147 24.46
The cost of housing have increased (i.e. renting or buying) Happening a lot 390 64.89
The cost of housing have increased (i.e. renting or buying) I don’t know 49 8.15
The costs of necessary expenses other than housing have increased (e.g., childcare; groceries; transit) Not happening 57 9.48
The costs of necessary expenses other than housing have increased (e.g., childcare; groceries; transit) Happening a little 267 44.43
The costs of necessary expenses other than housing have increased (e.g., childcare; groceries; transit) Happening a lot 184 30.62
The costs of necessary expenses other than housing have increased (e.g., childcare; groceries; transit) I don’t know 93 15.47

In what ways are people who are moving into your neighbourhood different than you? Check all that apply.

  • asked only to people who said yes to previous question
  • participants could select multiple answers. Figures and tables show how many times each answer was selected.
# 1 Racial or ethnic background Origine raciale ou ethnique
# 2 Income or wealth    Revenu ou richesse
# 3 Job or employment   Emploi
# 4 Education   Éducation
# 5 They are students   Ce sont des étudiants
# 6 Family structure    Structure familiale
# 7 Age Âge
# 8 Religion    Religion
# 9 Culture and values  Culture et valeurs
# 10    The activities they enjoy   Les activités qu’elles aiment
# 99    Other   Autre, veuillez spécifier
# -7    Not applicable  Non applicable

w2$pacer_differentpeople_1[w2$pacer_differentpeople_1==-7] <- NA
w2$pacer_differentpeople_2[w2$pacer_differentpeople_2==-7] <- NA
w2$pacer_differentpeople_3[w2$pacer_differentpeople_3==-7] <- NA
w2$pacer_differentpeople_4[w2$pacer_differentpeople_4==-7] <- NA
w2$pacer_differentpeople_5[w2$pacer_differentpeople_5==-7] <- NA
w2$pacer_differentpeople_6[w2$pacer_differentpeople_6==-7] <- NA
w2$pacer_differentpeople_7[w2$pacer_differentpeople_7==-7] <- NA
w2$pacer_differentpeople_8[w2$pacer_differentpeople_8==-7] <- NA
w2$pacer_differentpeople_9[w2$pacer_differentpeople_9==-7] <- NA
w2$pacer_differentpeople_10[w2$pacer_differentpeople_10==-7] <- NA

w2$pacer_differentpeople_1[w2$pacer_differentpeople_1==0] <- 2
w2$pacer_differentpeople_2[w2$pacer_differentpeople_2==0] <- 2
w2$pacer_differentpeople_3[w2$pacer_differentpeople_3==0] <- 2
w2$pacer_differentpeople_4[w2$pacer_differentpeople_4==0] <- 2
w2$pacer_differentpeople_5[w2$pacer_differentpeople_5==0] <- 2
w2$pacer_differentpeople_6[w2$pacer_differentpeople_6==0] <- 2
w2$pacer_differentpeople_7[w2$pacer_differentpeople_7==0] <- 2
w2$pacer_differentpeople_8[w2$pacer_differentpeople_8==0] <- 2
w2$pacer_differentpeople_9[w2$pacer_differentpeople_9==0] <- 2
w2$pacer_differentpeople_10[w2$pacer_differentpeople_10==0] <- 2
w2$pacer_differentpeople_99[w2$pacer_differentpeople_99==0] <- 2

t_1 <- select(w2, croise, pacer_differentpeople_1,pacer_differentpeople_2, pacer_differentpeople_3, pacer_differentpeople_4, pacer_differentpeople_5, pacer_differentpeople_6, pacer_differentpeople_7, pacer_differentpeople_8, pacer_differentpeople_9, pacer_differentpeople_10)
t_1 <- pivot_longer(t_1,
   cols = starts_with("pacer_differentpeople_"),
   names_to = "feature",
   names_prefix = "pacer_differentpeople_",
   values_to = "values",
   values_drop_na = TRUE)

t_1$values <- recode_factor(t_1$values, "1" = "Yes", "2" = "No", "77" = "I don't know")


## rename 
t_1$feature[t_1$feature== "1"] <- "Racial or ethnic background"
t_1$feature[t_1$feature== "2"] <- "Income or wealth"
t_1$feature[t_1$feature== "3"] <- "Job or employment"
t_1$feature[t_1$feature== "4"] <- "Education"
t_1$feature[t_1$feature== "5"] <- "They are students"
t_1$feature[t_1$feature== "6"] <- "Family structure"
t_1$feature[t_1$feature== "7"] <- "Age"
t_1$feature[t_1$feature== "8"] <- "Religion"
t_1$feature[t_1$feature== "9"] <- "Culture and values"
t_1$feature[t_1$feature== "10"] <- "The activities they enjoy"


t_1 <- t_1 %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACTPaletteYN) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 


plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
Age Yes 123 41.55
Age No 173 58.45
Culture and values Yes 80 27.03
Culture and values No 216 72.97
Education Yes 61 20.61
Education No 235 79.39
Family structure Yes 89 30.07
Family structure No 207 69.93
Income or wealth Yes 127 42.91
Income or wealth No 169 57.09
Job or employment Yes 68 22.97
Job or employment No 228 77.03
Racial or ethnic background Yes 136 45.95
Racial or ethnic background No 160 54.05
Religion Yes 49 16.55
Religion No 247 83.45
The activities they enjoy Yes 42 14.19
The activities they enjoy No 254 85.81
They are students Yes 43 14.53
They are students No 253 85.47
##### Other- write-in answers 

#w2$pacer_differentpeople_txt[w2$pacer_differentpeople_txt!=""]

Do people moving into your neighbourhood call it by a different name than long-term residents?

#pacer_neighname    

var_name <- w2$pacer_neighname  
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr:: summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(x = var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 47 7.82
No 324 53.91
I don’t know 230 38.27

How much interest do people moving into your neighbourhood take in existing businesses or organizations (e.g. community organizations, schools)?

#pacer_interestplaces   

var_name <- w2$pacer_interestplaces 
w2$var_name_f <- recode_factor(var_name, "1" = "A lot of interest", "2" = "Some interest", "3" = "No interest", "4" = "NA", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr:: summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(x = var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
A lot of interest 59 9.82
Some interest 171 28.45
No interest 38 6.32
NA 5 0.83
I don’t know 328 54.58

On a scale from 1 to 10 with 1 being the least and 10 being the most, overall how much change has happened in your neighbourhood during the last three to five years?

#pacer_change

var_name <- w2$pacer_change
w2$var_name_f <- recode_factor(var_name, "1" = "1. Least change",
                                                "2" = "2", 
                                                "3" = "3", 
                                                "4" = "4", 
                                                "5" = "5", 
                                                "6" = "6", 
                                                "7" = "7",
                                                "8" = "8",
                                                "9" = "9", 
                               "10" = "10. Most change")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr:: summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(x = var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalettecont)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
  1. Least change
11 1.83
2 22 3.66
3 48 7.99
4 53 8.82
5 90 14.98
6 102 16.97
7 137 22.80
8 76 12.65
9 22 3.66
  1. Most change
40 6.66

On a scale from 1 to 10 with 1 being the slowest and 10 being the fastest, how quickly have changes been happening in your neighbourhood during the last three to five years?

#pacer_speed    
var_name <- w2$pacer_speed
w2$var_name_f <- recode_factor(var_name, "1" = "1. Slowest", "1" = "1",
                                                "2" = "2", 
                                                "3" = "3", 
                                                "4" = "4", 
                                                "5" = "5", 
                                                "6" = "6", 
                                                "7" = "7",
                                                "8" = "8",
                                                "9" = "9",
                               "10" = "10. Fastest")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr:: summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(x = var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalettecont)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
1 27 4.49
2 19 3.16
3 46 7.65
4 62 10.32
5 90 14.98
6 105 17.47
7 115 19.13
8 88 14.64
9 26 4.33
  1. Fastest
23 3.83

These questions will ask for your feelings about any changes within your neighbourhood. Rate your agreement with each statement from “strongly agree” to “strongly disagree.”

#### pacer_feelings_a

INTERACT5likert <- c("#60C472", "#76D24A" , "#EBF0F8", "#1596ff" ,"#0c77cf", "#666666")

t_1 <- select(w2, croise, pacer_feelings_a, pacer_feelings_b, pacer_feelings_c, pacer_feelings_d, pacer_feelings_e, pacer_feelings_f, pacer_feelings_g, pacer_feelings_h, pacer_feelings_i)
t_1 <- pivot_longer(t_1,
   cols = starts_with("pacer_feelings_"),
   names_to = "feature",
   names_prefix = "pacer_feelings_",
   values_to = "values",
   values_drop_na = TRUE)

t_1$values <- recode_factor(t_1$values, "1" = "Strongly agree", "2" = "Agree", "3" = "Neither", "4"= "Disagree", "5" ="Strongly disagree", "77" = "I don't know")

## rename 
t_1$feature[t_1$feature== "a"] <- "If I had to move right now, I could afford to move to a similar house or apartment within my neighbourhood"
t_1$feature[t_1$feature== "b"] <- "I feel welcome in most new businesses in my neighbourhood"
t_1$feature[t_1$feature== "c"] <- "I feel the personality of my neighbourhood has changed"
t_1$feature[t_1$feature== "d"] <- "I trust people moving into my neighbourhood"
t_1$feature[t_1$feature== "e"] <- "I feel good about the changes happening in my neighbourhood"
t_1$feature[t_1$feature== "f"] <- "I am afraid of being pushed or forced out of my neighbourhood"
t_1$feature[t_1$feature== "g"] <- "I would support changes to my neighbourhood (e.g. new stores, parks) even if the changes make it more expensive for me to live here"
t_1$feature[t_1$feature== "h"] <- "Changes in my neighbourhood are meant for people like me"
t_1$feature[t_1$feature== "i"] <- "My neighbourhood is experiencing development that has caused concerns about higher cost of living."

t_1 <- t_1 %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACT5likert) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 

plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
Changes in my neighbourhood are meant for people like me Strongly agree 72 11.98
Changes in my neighbourhood are meant for people like me Agree 220 36.61
Changes in my neighbourhood are meant for people like me Neither 186 30.95
Changes in my neighbourhood are meant for people like me Disagree 61 10.15
Changes in my neighbourhood are meant for people like me Strongly disagree 40 6.66
Changes in my neighbourhood are meant for people like me I don’t know 22 3.66
I am afraid of being pushed or forced out of my neighbourhood Strongly agree 27 4.49
I am afraid of being pushed or forced out of my neighbourhood Agree 72 11.98
I am afraid of being pushed or forced out of my neighbourhood Neither 78 12.98
I am afraid of being pushed or forced out of my neighbourhood Disagree 136 22.63
I am afraid of being pushed or forced out of my neighbourhood Strongly disagree 240 39.93
I am afraid of being pushed or forced out of my neighbourhood I don’t know 48 7.99
I feel good about the changes happening in my neighbourhood Strongly agree 108 17.97
I feel good about the changes happening in my neighbourhood Agree 258 42.93
I feel good about the changes happening in my neighbourhood Neither 148 24.63
I feel good about the changes happening in my neighbourhood Disagree 50 8.32
I feel good about the changes happening in my neighbourhood Strongly disagree 22 3.66
I feel good about the changes happening in my neighbourhood I don’t know 15 2.50
I feel the personality of my neighbourhood has changed Strongly agree 30 4.99
I feel the personality of my neighbourhood has changed Agree 161 26.79
I feel the personality of my neighbourhood has changed Neither 212 35.27
I feel the personality of my neighbourhood has changed Disagree 121 20.13
I feel the personality of my neighbourhood has changed Strongly disagree 52 8.65
I feel the personality of my neighbourhood has changed I don’t know 25 4.16
I feel welcome in most new businesses in my neighbourhood Strongly agree 291 48.42
I feel welcome in most new businesses in my neighbourhood Agree 226 37.60
I feel welcome in most new businesses in my neighbourhood Neither 50 8.32
I feel welcome in most new businesses in my neighbourhood Disagree 10 1.66
I feel welcome in most new businesses in my neighbourhood Strongly disagree 6 1.00
I feel welcome in most new businesses in my neighbourhood I don’t know 18 3.00
I trust people moving into my neighbourhood Strongly agree 98 16.31
I trust people moving into my neighbourhood Agree 293 48.75
I trust people moving into my neighbourhood Neither 160 26.62
I trust people moving into my neighbourhood Disagree 27 4.49
I trust people moving into my neighbourhood Strongly disagree 12 2.00
I trust people moving into my neighbourhood I don’t know 11 1.83
I would support changes to my neighbourhood (e.g. new stores, parks) even if the changes make it more expensive for me to live here Strongly agree 82 13.64
I would support changes to my neighbourhood (e.g. new stores, parks) even if the changes make it more expensive for me to live here Agree 206 34.28
I would support changes to my neighbourhood (e.g. new stores, parks) even if the changes make it more expensive for me to live here Neither 164 27.29
I would support changes to my neighbourhood (e.g. new stores, parks) even if the changes make it more expensive for me to live here Disagree 93 15.47
I would support changes to my neighbourhood (e.g. new stores, parks) even if the changes make it more expensive for me to live here Strongly disagree 40 6.66
I would support changes to my neighbourhood (e.g. new stores, parks) even if the changes make it more expensive for me to live here I don’t know 16 2.66
If I had to move right now, I could afford to move to a similar house or apartment within my neighbourhood Strongly agree 78 12.98
If I had to move right now, I could afford to move to a similar house or apartment within my neighbourhood Agree 157 26.12
If I had to move right now, I could afford to move to a similar house or apartment within my neighbourhood Neither 81 13.48
If I had to move right now, I could afford to move to a similar house or apartment within my neighbourhood Disagree 136 22.63
If I had to move right now, I could afford to move to a similar house or apartment within my neighbourhood Strongly disagree 138 22.96
If I had to move right now, I could afford to move to a similar house or apartment within my neighbourhood I don’t know 11 1.83
My neighbourhood is experiencing development that has caused concerns about higher cost of living. Strongly agree 125 20.80
My neighbourhood is experiencing development that has caused concerns about higher cost of living. Agree 192 31.95
My neighbourhood is experiencing development that has caused concerns about higher cost of living. Neither 145 24.13
My neighbourhood is experiencing development that has caused concerns about higher cost of living. Disagree 74 12.31
My neighbourhood is experiencing development that has caused concerns about higher cost of living. Strongly disagree 40 6.66
My neighbourhood is experiencing development that has caused concerns about higher cost of living. I don’t know 25 4.16

On a scale from 1 to 10 with 1 being the not at all and 10 being very much so, do you think your neighbourhood is going through gentrification?

#gentri_percep   
var_name <- w2$gentri_percep
w2$var_name_f <- recode_factor(var_name, "1" = "1. Not at all", "2" = "2", 
                                                "3" = "3", 
                                                "4" = "4", 
                                                "5" = "5", 
                                                "6" = "6", 
                                                "7" = "7",
                                                "8" = "8",
                                                "9" = "9",
                               "10" = "10. Very much so")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr:: summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(x = var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTPalettecont)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
  1. Not at all
59 9.82
2 33 5.49
3 30 4.99
4 34 5.66
5 45 7.49
6 79 13.14
7 92 15.31
8 92 15.31
9 52 8.65
  1. Very much so
85 14.14

Section 8: Neighbourhood Selection

Before moving into your current dwelling, when you were looking for a neighbourhood to live in, to what extent were the following characteristics important? Please report your perspectives, even if the neighbourhood where you currently live does not have these characteristics

a. Good access to public transportation

#neigh_pref_a

var_name <- w2$neigh_pref_a
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))
##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 427 71.05
Somewhat important 105 17.47
Not very important 41 6.82
Not important at all 21 3.49
I don’t know 7 1.16

b. Sufficient parks and green spaces

var_name <- w2$neigh_pref_b
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 284 47.25
Somewhat important 247 41.10
Not very important 49 8.15
Not important at all 12 2.00
I don’t know 9 1.50

c. Sufficient shops and services

#neigh_pref_c
var_name <- w2$neigh_pref_c
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 310 51.58
Somewhat important 237 39.43
Not very important 38 6.32
Not important at all 10 1.66
I don’t know 6 1.00

d. Proximity to doctors, a pharmacy or other health services

var_name <- w2$neigh_pref_d
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 166 27.62
Somewhat important 208 34.61
Not very important 174 28.95
Not important at all 43 7.15
I don’t know 10 1.66

e. A good knowledge of the neighbourhood

var_name <- w2$neigh_pref_e
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 111 18.47
Somewhat important 196 32.61
Not very important 207 34.44
Not important at all 75 12.48
I don’t know 12 2.00

f. Presence of relatives, friends or acquaintances

#neigh_pref_f

var_name <- w2$neigh_pref_f
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 71 11.81
Somewhat important 131 21.80
Not very important 192 31.95
Not important at all 196 32.61
I don’t know 11 1.83

g. A neighbourhood where it is pleasant to walk

#neigh_pref_g
var_name <- w2$neigh_pref_g
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 308 51.25
Somewhat important 233 38.77
Not very important 43 7.15
Not important at all 11 1.83
I don’t know 6 1.00

h. A neighbourhood where it is practical to move around by car (ease of parking, low traffic, good access by car)

#neigh_pref_h
var_name <- w2$neigh_pref_h
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 96 15.97
Somewhat important 148 24.63
Not very important 122 20.30
Not important at all 210 34.94
I don’t know 25 4.16

i. Presence of good schools

#neigh_pref_i
var_name <- w2$neigh_pref_i
w2$var_name_f <- recode_factor(var_name, "1" = "Very important", "2" = "Somewhat important", "3" = "Not very important", "4" = "Not important at all", "77" = "I don't know")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very important 98 16.31
Somewhat important 131 21.80
Not very important 74 12.31
Not important at all 256 42.60
I don’t know 42 6.99

If you had the choice, how long would you remain in your current home?

#neigh_stay 

var_name <- w2$neigh_stay
w2$var_name_f <- recode_factor(var_name, "1" = "I would move now", "2" = "Less than 3 years", "3" = "3 to 5 years", "4" = "More than 5 years but less than 10 years", "5"= "10 or more years")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
I would move now 71 11.81
Less than 3 years 67 11.15
3 to 5 years 87 14.48
More than 5 years but less than 10 years 90 14.98
10 or more years 286 47.59

Section 9: Activity Tracking

Do you currently own or use any of the following devices or smartphone apps to monitor your physical activity?

No

#tracking1 and tracking1_use


tracking1_no <- round((sum(w2$tracking1_no)/ length(w2$tracking1_no))*100,2)
tracking1_no_n <- sum(w2$tracking1_no)

tracking1_no_interest <- round((sum(w2$tracking1_no_interest)/ length(w2$tracking1_no_interest))*100,2)
tracking1_no_interest_n <- sum(w2$tracking1_no_interest)
no_tracking <- data.frame(Response=c("I do not have one but might be interested in trying one", "I do not have one and I am not interested in trying one"),
                          Count = c(tracking1_no_n, tracking1_no_interest_n),
                          Percentage= c(tracking1_no, tracking1_no_interest))

kable(no_tracking) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")  
Response Count Percentage
I do not have one but might be interested in trying one 155 25.79
I do not have one and I am not interested in trying one 134 22.30

Own

#tracking own 

# Create a vector with variable names
response = paste0("tracking1_own_", 1:4)

# Empty vector to stor output
tracking1_own_prop <- c()

# Calculate univariate proportions
for(i in response){
  tracking1_own_prop[i] <- sum(w2[,i]) / nrow(w2)
}

# Transform
tracking1_own_prop <- as.data.frame(tracking1_own_prop)
tracking1_own_prop$Own <- c("Wearable devices (Fitbits, Garmins, and Jawbone, etc.)","Smart watches (Apple Watch, Galaxy Gear, Samsung Gear, etc.)","Smartphone app (Apple Health, Samsung Health, Google Fit, Strava, etc.)","Other")

tracking1_own_prop$plot<- factor(tracking1_own_prop$Own, tracking1_own_prop$Own)

ggplot(tracking1_own_prop, aes(x = plot, y = tracking1_own_prop)) + geom_bar(stat = "identity", fill = "#76D24A") + xlab("") + ylab("Percent of participants who selected this answer") + theme(axis.text.x  = element_text(size= 12, angle=0, vjust=.6))  + scale_x_discrete(labels = function(plot) str_wrap(plot, width = 10))

tracking1_own_prop <- tracking1_own_prop[-c(3)]
tracking1_own_prop$tracking1_own_prop <- round(tracking1_own_prop$tracking1_own_prop*100,2)

#tracking1_own_prop <- setcolorder(tracking1_own_prop, c("Own", "tracking1_own_prop"))

colnames(tracking1_own_prop) <- c("Response", "Percent of participants who selected this answer")
tracking1_own_prop$Count <- c(sum(w2$tracking1_own_1), sum(w2$tracking1_own_2),sum(w2$tracking1_own_3),sum(w2$tracking1_own_4))

kable(tracking1_own_prop) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")  
Response Percent of participants who selected this answer Count
tracking1_own_1 18.30 Wearable devices (Fitbits, Garmins, and Jawbone, etc.) 110
tracking1_own_2 11.48 Smart watches (Apple Watch, Galaxy Gear, Samsung Gear, etc.) 69
tracking1_own_3 31.28 Smartphone app (Apple Health, Samsung Health, Google Fit, Strava, etc.) 188
tracking1_own_4 3.33 Other 20

Use

#tracking use

# Create a vector with variable names
response = paste0("tracking1_use_", 1:4)

# Empty vector to stor output
tracking1_use_prop <- c()

# Calculate univariate proportions
for(i in response){
  tracking1_use_prop[i] <- sum(w2[,i]) / nrow(w2)
}

# Transform
tracking1_use_prop <- as.data.frame(tracking1_use_prop)
tracking1_use_prop$use <- c("Wearable devices (Fitbits, Garmins, and Jawbone, etc.)","Smart watches (Apple Watch, Galaxy Gear, Samsung Gear, etc.)","Smartphone app (Apple Health, Samsung Health, Google Fit, Strava, etc.)","Other")

tracking1_use_prop$plot<- factor(tracking1_use_prop$use, tracking1_use_prop$use)

ggplot(tracking1_use_prop, aes(x = plot, y = tracking1_use_prop)) + geom_bar(stat = "identity", fill = "#76D24A") + xlab("") + ylab("Percent of participants who selected this answer") + theme(axis.text.x  = element_text(angle=0, vjust=.6))  + scale_x_discrete(labels = function(plot) str_wrap(plot, width = 10))

tracking1_use_prop <- tracking1_use_prop[-c(3)]
tracking1_use_prop$tracking1_use_prop <- round(tracking1_use_prop$tracking1_use_prop*100,2)

#tracking1_use_prop <- setcolorder(tracking1_use_prop, c("use", "tracking1_use_prop"))

colnames(tracking1_use_prop) <- c("Response", "Percent of participants who selected this answer")
tracking1_use_prop$Count <- c(sum(w2$tracking1_use_1), sum(w2$tracking1_use_2),sum(w2$tracking1_use_3),sum(w2$tracking1_use_4))
kable(tracking1_use_prop) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")  
Response Percent of participants who selected this answer Count
tracking1_use_1 11.98 Wearable devices (Fitbits, Garmins, and Jawbone, etc.) 72
tracking1_use_2 9.15 Smart watches (Apple Watch, Galaxy Gear, Samsung Gear, etc.) 55
tracking1_use_3 23.79 Smartphone app (Apple Health, Samsung Health, Google Fit, Strava, etc.) 143
tracking1_use_4 3.00 Other 18

Thinking about a typical month, how many days on average do you use your device or smartphone app to monitor your physical activity? If you own several activity trackers, choose the one that you use most often.

#tracking2

w2$tracking2[w2$tracking2==-7] <- NA

ggplot(w2, aes(tracking2)) + geom_histogram(na.rm = TRUE, binwidth = 1, fill="#76D24A") + xlab("Days per month") 

When using a device or app to monitor your physical activity, how concerned are you about the possibility of your location being known by the company which developed the device or app?

#tracking3a
w2$tracking3a[w2$tracking3a==-7] <- NA

var_name <- w2$tracking3a
w2$var_name_f <- recode_factor(var_name, "1" = "Not at all", "2" = "Slightly", "3" = "Moderately", "4" = "Very much", "5" = "Extremely", "6"= "I have no opinion on the subject")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
           dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Not at all 89 14.81
Slightly 51 8.49
Moderately 36 5.99
Very much 19 3.16
Extremely 7 1.16
I have no opinion on the subject 10 1.66
NA 389 64.73

If you had to use a device or app, how concerned would you be about the possibility of your location being known by the company which developed the device or app?

#tracking3b
w2$tracking3b[w2$tracking3b==-7] <- NA

var_name <- w2$tracking3b
w2$var_name_f <- recode_factor(var_name, "1" = "Not at all", "2" = "Slightly", "3" = "Moderately", "4" = "Very much", "5" = "Extremely", "6"= "I have no opinion on the subject")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalettecont) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Not at all 73 12.15
Slightly 71 11.81
Moderately 60 9.98
Very much 68 11.31
Extremely 51 8.49
I have no opinion on the subject 36 5.99
NA 242 40.27

How concerned are you about the possibility of your location being known by your network mobile provider when using a smartphone?

#tracking4
 
w2$tracking4[w2$tracking4==-7] <- NA

var_name <- w2$tracking4
w2$var_name_f <- recode_factor(var_name, "1" = "Not at all", "2" = "Slightly", "3" = "Moderately", "4" = "Very much", "5" = "Extremely", "6"= "No opinion", "7" = "I do not use a smartphone")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalettecont) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Not at all 166 27.62
Slightly 126 20.97
Moderately 135 22.46
Very much 66 10.98
Extremely 52 8.65
No opinion 22 3.66
I do not use a smartphone 34 5.66

Compared with friends of my age, my concern regarding protecting my privacy is.

#tracking5
w2$tracking5[w2$tracking5==-7] <- NA
var_name <- w2$tracking5
w2$var_name_f <- recode_factor(var_name, "1" = "Much lower", "2" = "Lower", "3" = "About the same", "4" = "Higher", "5" = "Much higher")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Much lower 25 4.16
Lower 91 15.14
About the same 337 56.07
Higher 123 20.47
Much higher 25 4.16

Section 10: COVID-19 - most closed phase

The following questions are about your activities and how you felt during the most closed phase of the COVID-19 lockdown.

During the most closed phase of the COVID-19 lockdown, compared to your typical habits prior to the COVID-19 pandemic, how many trips per week did you make?

This time last year, I made…

#cov_con_trips_pre
#removing over 100 outlier: 
w2$cov_con_trips_pre[w2$cov_con_trips_pre>=100] <- NA
ggplot(w2, aes(x= cov_con_trips_pre)) + geom_bar(na.rm = TRUE,fill="#76D24A", binwidth = 1) + xlab("Number of trips per week") + facet_wrap( ~ croise)

summary(w2$cov_con_trips_pre)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.00    6.00   10.00   10.72   14.00   40.00       2

During the most closed phase of the COVID-19 lockdown, I made…

#cov_con_trips

ggplot(w2, aes(x= cov_con_trips)) + geom_bar(na.rm = TRUE,fill="#76D24A", binwidth = 1) + xlab("Number of trips per week") + facet_wrap( ~ croise)

summary(w2$cov_con_trips)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   0.000   2.000   3.175   4.000  40.000

During the most closed phase of the COVID-19 lockdown, did you make trips for the following activities?

t_1 <- select(w2, croise, cov_con_triptype_a, cov_con_triptype_b, cov_con_triptype_c, cov_con_triptype_d, cov_con_triptype_e, cov_con_triptype_f)
t_1 <- pivot_longer(t_1,
   cols = starts_with("cov_con_triptype_"),
   names_to = "perception",
   names_prefix = "cov_con_triptype_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "Work"
t_1$perception[t_1$perception== "b"] <- "School"
t_1$perception[t_1$perception== "c"] <- "Groceries"
t_1$perception[t_1$perception== "d"] <- "Medical trips"
t_1$perception[t_1$perception== "e"] <- "Care-taking"
t_1$perception[t_1$perception== "f"] <- "Social, entertainment, eating out"
t_1$perception[t_1$perception== "g"] <- "Recreation / exercise"


## recode

t_1$values <- recode_factor(t_1$values, "1" = "Yes", "2" = "No")
##### Table
t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACTPaletteYN) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise perception values n pct
Care-taking Yes 116 19.30
Care-taking No 485 80.70
Groceries Yes 515 85.69
Groceries No 86 14.31
Medical trips Yes 188 31.28
Medical trips No 413 68.72
School Yes 26 4.33
School No 575 95.67
Social, entertainment, eating out Yes 97 16.14
Social, entertainment, eating out No 504 83.86
Work Yes 135 22.46
Work No 466 77.54

During the most closed phase of the COVID-19 lockdown, did you use the following modes of transportation in a typical week more than, less than,or the same as you did prior to the COVID-19 pandemic?

t_1 <- select(w2, croise, cov_con_mode_a, cov_con_mode_b, cov_con_mode_c, cov_con_mode_d)
t_1 <- pivot_longer(t_1,
   cols = starts_with("cov_con_mode_"),
   names_to = "perception",
   names_prefix = "cov_con_mode_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "Driving"
t_1$perception[t_1$perception== "b"] <- "Cycling"
t_1$perception[t_1$perception== "c"] <- "Walking"
t_1$perception[t_1$perception== "d"] <- "Public Transit"


## recode

t_1$values <- recode_factor(t_1$values, "1" = "Less", "2" = "Same as before COVID-19", "3" = "More")
##### Table
t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = rev(INTERACTshorterfade3)) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise perception values n pct
Cycling Less 245 40.77
Cycling Same as before COVID-19 266 44.26
Cycling More 90 14.98
Driving Less 291 48.42
Driving Same as before COVID-19 188 31.28
Driving More 122 20.30
Public Transit Less 521 86.69
Public Transit Same as before COVID-19 75 12.48
Public Transit More 5 0.83
Walking Less 126 20.97
Walking Same as before COVID-19 172 28.62
Walking More 303 50.42

During the most closed phase of the COVID-19 lockdown, how satisfied were you with your level of physical activity?

var_name <- w2$cov_con_pa
w2$var_name_f <- recode_factor(var_name, "1" = "Very satisfied", 
                                                "2" = "Somewhat satisfied", 
                                                "3" = "Neutral", 
                                                "4" = "Somewhat dissatisfied", 
                                                "5" = "Very dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very satisfied 62 10.32
Somewhat satisfied 163 27.12
Neutral 84 13.98
Somewhat dissatisfied 193 32.11
Very dissatisfied 99 16.47

During the most closed phase of the COVID-19 lockdown, how satisfied were you with your ability to connect with others?

var_name <- w2$cov_con_social
w2$var_name_f <- recode_factor(var_name, "1" = "Very satisfied", 
                                                "2" = "Somewhat satisfied", 
                                                "3" = "Neutral", 
                                                "4" = "Somewhat dissatisfied", 
                                                "5" = "Very dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very satisfied 19 3.16
Somewhat satisfied 107 17.80
Neutral 104 17.30
Somewhat dissatisfied 255 42.43
Very dissatisfied 116 19.30

During the most closed phase of the COVID-19 lockdown, how would you have rated your overall well-being?

var_name <- w2$cov_con_wb

w2$var_name_f <- recode_factor(var_name, "0" = "0. As bad as it could be", 
                                                "1" = "1",
                                                "2" = "2", 
                                                "3" = "3", 
                                                "4" = "4", 
                                                "5" = "5", 
                                                "6" = "6", 
                                                "7" = "7",
                                                "8" = "8",
                                                "9" = "9",
                                                "10" = "10. As good as it could be")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTfade)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
  1. As bad as it could be
7 1.16
1 10 1.66
2 13 2.16
3 54 8.99
4 62 10.32
5 77 12.81
6 79 13.14
7 122 20.30
8 90 14.98
9 25 4.16
  1. As good as it could be
62 10.32

Section 11: COVID-19 Current context

The following questions are about your activities and how you feel now in the current context.

In the current context, how many trips do you make per week?

#cov_decon_trips

ggplot(w2, aes(x= cov_decon_trips)) + geom_bar(na.rm = TRUE,fill="#76D24A", binwidth = 1) + xlab("Number of trips per week") + facet_wrap( ~ croise)

summary(w2$cov_decon_trips)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   2.000   6.000   6.913  10.000  45.000

In the current context, do you make trips for the following activities?

t_1 <- select(w2, croise, cov_decon_triptype_a, cov_decon_triptype_b, cov_decon_triptype_c, cov_decon_triptype_d, cov_decon_triptype_e, cov_decon_triptype_f)
t_1 <- pivot_longer(t_1,
   cols = starts_with("cov_decon_triptype_"),
   names_to = "perception",
   names_prefix = "cov_decon_triptype_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "Work"
t_1$perception[t_1$perception== "b"] <- "School"
t_1$perception[t_1$perception== "c"] <- "Groceries"
t_1$perception[t_1$perception== "d"] <- "Medical trips"
t_1$perception[t_1$perception== "e"] <- "Care-taking"
t_1$perception[t_1$perception== "f"] <- "Social, entertainment, eating out"
t_1$perception[t_1$perception== "g"] <- "Recreation / exercise"


## recode

t_1$values <- recode_factor(t_1$values, "1" = "Yes", "2" = "No")
##### Table
t_1<- t_1 %>% 
  group_by(croise,  perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACTPaletteYN) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise perception values n pct
Care-taking Yes 138 22.96
Care-taking No 463 77.04
Groceries Yes 560 93.18
Groceries No 41 6.82
Medical trips Yes 301 50.08
Medical trips No 300 49.92
School Yes 67 11.15
School No 534 88.85
Social, entertainment, eating out Yes 260 43.26
Social, entertainment, eating out No 341 56.74
Work Yes 239 39.77
Work No 362 60.23

In the current context, do you use the following modes of transportation less than, more than, or the same as you did prior to the COVID-19 pandemic?

t_1 <- select(w2, croise, cov_decon_mode_a, cov_decon_mode_b, cov_decon_mode_c, cov_decon_mode_d)
t_1 <- pivot_longer(t_1,
   cols = starts_with("cov_decon_mode_"),
   names_to = "perception",
   names_prefix = "cov_decon_mode_",
   values_to = "values",
   values_drop_na = TRUE)
## rename 

t_1$perception[t_1$perception== "a"] <- "Driving"
t_1$perception[t_1$perception== "b"] <- "Cycling"
t_1$perception[t_1$perception== "c"] <- "Walking"
t_1$perception[t_1$perception== "d"] <- "Public Transit"


## recode

t_1$values <- recode_factor(t_1$values, "1" = "Less", "2" = "Same as before COVID-19", "3" = "More")
##### Table
t_1<- t_1 %>% 
  group_by(croise, perception, values) %>% 
  dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= perception, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = rev(INTERACTshorterfade3)) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise)
  plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise perception values n pct
Cycling Less 208 34.61
Cycling Same as before COVID-19 309 51.41
Cycling More 84 13.98
Driving Less 226 37.60
Driving Same as before COVID-19 270 44.93
Driving More 105 17.47
Public Transit Less 459 76.37
Public Transit Same as before COVID-19 126 20.97
Public Transit More 16 2.66
Walking Less 99 16.47
Walking Same as before COVID-19 252 41.93
Walking More 250 41.60

In the current context, have you been using the following less than, more than, or the same as you did prior to the COVID-19 pandemic?

Protected bike paths

#cov_decon_vas_a

var_name <- w2$cov_decon_vas_a
w2$var_name_f <- recode_factor(var_name, "1" = "Less", "2" = "Same as before COVID-19", "3" = "More")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTshorterfade3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Less 142 23.63
Same as before COVID-19 308 51.25
More 151 25.12

Pedestrianized streets

#cov_decon_vas_b

var_name <- w2$cov_decon_vas_b
w2$var_name_f <- recode_factor(var_name, "1" = "Less", "2" = "Same as before COVID-19", "3" = "More")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTshorterfade3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Less 98 16.31
Same as before COVID-19 301 50.08
More 202 33.61

City Parks

#cov_decon_vas_c

var_name <- w2$cov_decon_vas_c
w2$var_name_f <- recode_factor(var_name, "1" = "Less", "2" = "Same as before COVID-19", "3" = "More")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTshorterfade3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Less 104 17.30
Same as before COVID-19 245 40.77
More 252 41.93

Public spaces (e.g. parklets, public plazas, squares, etc.)

#cov_decon_vas_d

var_name <- w2$cov_decon_vas_d
w2$var_name_f <- recode_factor(var_name, "1" = "Less", "2" = "Same as before COVID-19", "3" = "More")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTshorterfade3)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Less 171 28.45
Same as before COVID-19 306 50.92
More 124 20.63

In the current context, how satisfied are you with your level of physical activity?

var_name <- w2$cov_decon_pa
w2$var_name_f <- recode_factor(var_name, "1" = "Very satisfied", 
                                                "2" = "Somewhat satisfied", 
                                                "3" = "Neutral", 
                                                "4" = "Somewhat dissatisfied", 
                                                "5" = "Very dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very satisfied 63 10.48
Somewhat satisfied 177 29.45
Neutral 102 16.97
Somewhat dissatisfied 190 31.61
Very dissatisfied 69 11.48

In the current context, how satisfied are you with your ability to connect with others?

var_name <- w2$cov_decon_social
w2$var_name_f <- recode_factor(var_name, "1" = "Very satisfied", 
                                                "2" = "Somewhat satisfied", 
                                                "3" = "Neutral", 
                                                "4" = "Somewhat dissatisfied", 
                                                "5" = "Very dissatisfied")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalette3) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very satisfied 28 4.66
Somewhat satisfied 171 28.45
Neutral 131 21.80
Somewhat dissatisfied 213 35.44
Very dissatisfied 58 9.65

In the current context, how would you rate your overall well-being?

var_name <- w2$cov_decon_wb

w2$var_name_f <- recode_factor(var_name, "0" = "0. As bad as it could be", 
                                                "1" = "1",
                                                "2" = "2", 
                                                "3" = "3", 
                                                "4" = "4", 
                                                "5" = "5", 
                                                "6" = "6", 
                                                "7" = "7",
                                                "8" = "8",
                                                "9" = "9",
                                                "10" = "10. As good as it could be")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTfade)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
  1. As bad as it could be
9 1.50
1 3 0.50
2 5 0.83
3 27 4.49
4 44 7.32
5 61 10.15
6 82 13.64
7 136 22.63
8 130 21.63
9 44 7.32
  1. As good as it could be
60 9.98

Section 12: Demographics

Thinking about where you live now, are you

#house_tenure
## zoe check
w2$house_tenure[w2$house_tenure==-7] <- NA

var_name <- w2$house_tenure

w2$var_name_f <- recode_factor(var_name, "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" = "I don't know")

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteSet) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_grid(~croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
An owner 316 52.58
A tenant 177 29.45
Resident in a relative or friend’s home 27 4.49
Resident other than in a relative or friend’s home 2 0.33
Other 6 1.00
I don’t know 1 0.17
NA 72 11.98

In what type of dwelling do you currently live? Is it:

#dwelling_type
w2$dwelling_type[w2$dwelling_type==-7] <- NA

var_name <- w2$dwelling_type

w2$var_name_f <- recode_factor(var_name, "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", "77" = "NA")

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteSet) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response")+ 
  facet_grid(~croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Single detached house 99 16.47
Semi-detached house 46 7.65
Row house 29 4.83
An apartment (or condo) in a duplex or triplex 187 31.11
Apartment (or condo) in building with fewer than 5 storeys 108 17.97
Apartment (or condo) in building with more than 5 storeys 43 7.15
Mobile home/movable dwelling 2 0.33
Senior’s home 1 0.17
Other 13 2.16
NA 1 0.17
NA 72 11.98

What is your current gender identity?

#gender 
var_name <- w2$gender

w2$var_name_f <- recode_factor(var_name, "1"="Man",
                                                "2"="Woman",
                                                "3"="Trans man", 
                                                "4"="Trans woman", 
                                                "5"="Genderqueer/Gender non-conforming", 
                                                "6"="Different identity")

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=45, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteSet) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Man 198 32.95
Woman 389 64.73
Trans woman 1 0.17
Genderqueer/Gender non-conforming 11 1.83
Different identity 2 0.33

What sex were you assigned at birth?

*Asked only to new participants - w1 data reported for returning participants

# Sex

var_name <- w2$sex
w2$var_name_f <- recode_factor(var_name, "1"="Male",
                                                "2"="Female",
                                                "3"="Other")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteSet) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Male 197 32.78
Female 392 65.22
Other 1 0.17
NA 11 1.83

What is your marital status? Are you…

#marital_status

var_name <- w2$marital_status
w2$var_name_f <- recode_factor(var_name, "1" = "Single", "2" = "Married/commonlaw", "3" = "Separated/divorced", "4" = "Widowed")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteSet) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Single 189 31.45
Married/commonlaw 330 54.91
Separated/divorced 68 11.31
Widowed 14 2.33

Do you have children?

#children

var_name <- w2$children
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 308 51.25
No 293 48.75

How many children do you have?

#living_children

w2$living_children[w2$living_children==-7] <- NA
ggplot(w2, aes(x= living_children)) + geom_bar(na.rm = TRUE,fill="#76D24A", binwidth = 1) + xlab("Number of children") + facet_grid(~ croise)

summary(w2$living_children)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   1.000   1.000   2.000   1.951   2.000   5.000     293

What is your current living arrangement? Do you live

Participants could choose multiple answers

#living_arrange  

w2$living_arrange_1[w2$living_arrange_1==-7] <- NA

var_name <- w2$living_arrange_1
w2$var_name_f <- recode_factor(var_name, "1" = "Alone", "0" = "With other people")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Alone 168 27.95
With other people 433 72.05
# Create a vector with variable names
response = paste0("living_arrange_", 2:7)

# Empty vector to stor output
living_arrange_prop <- c()

# Calculate univariate proportions
for(i in response){
  living_arrange_prop[i] <- sum(w2[,i]) / nrow(w2)
}

# Transform
living_arrange_prop <- as.data.frame(living_arrange_prop)
living_arrange_prop$Response <- c("With a spouse (or partner)","With children","With grandchildren","With relatives or siblings?", "With friends", "With other people")

living_arrange_prop$plot<- factor(living_arrange_prop$Response, living_arrange_prop$Response)

ggplot(living_arrange_prop, aes(x = plot, y = living_arrange_prop)) + geom_bar(stat = "identity", fill = "#76D24A") + xlab("") + ylab("Percentage of participants who selected this answer") + theme(axis.text.x  = element_text(size=12, angle=0, vjust=.6)) + scale_x_discrete(labels = function(plot) str_wrap(plot, width = 10)) 

living_arrange_prop$living_arrange_prop <- round(living_arrange_prop$living_arrange_prop*100,2)

#living_arrange_prop <- setcolorder(living_arrange_prop, c("Response", "living_arrange_prop")

colnames(living_arrange_prop) <- c("Response", "Percentage of participants who selected this answer")

living_arrange_prop <- living_arrange_prop[-c(3)]
kable(living_arrange_prop) %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")  
Response Percentage of participants who selected this answer
living_arrange_2 57.40 With a spouse (or partner)
living_arrange_3 28.29 With children
living_arrange_4 0.50 With grandchildren
living_arrange_5 5.66 With relatives or siblings?
living_arrange_6 2.66 With friends
living_arrange_7 2.83 With other people

How many children under the age of 16 live in your household?

#children_household

p <- ggplot(w2, aes(x = children_household)) + 
  geom_bar(na.rm = TRUE,fill="#76D24A", binwidth = 1) +
  xlab("Number of children under 16 in household") + 
  facet_wrap(~ croise)

plot(p)

summary(w2$children_household)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.4276  0.0000 22.0000

How many adults aged 16 or older live in your household including yourself?

ggplot(w2, aes(x= adults_household)) + geom_bar(na.rm = TRUE,fill="#76D24A", binwidth = 1) + xlab("Number of adults in household") + facet_wrap(~ croise)

summary(w2$adults_household)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1.00    1.00    2.00    1.94    2.00   11.00

When did you move to your current residence?

#residence
w2$residence[w2$residence==""] <- NA

residence <- as.integer(format(as.Date(w2$residence),"%Y"))
time <- 2021 - residence

ggplot(w2, aes(x = time)) + geom_histogram(na.rm=TRUE, binwidth = 1, fill="#76D24A") + xlab("Years since moving to current residence") + facet_grid(~croise)

summary(time)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    0.00    4.00    8.00   12.03   17.00   62.00      11

Were you born in Canada?

#born_can
var_name <- w2$born_can
w2$var_name_f <- recode_factor(var_name, "1" = "Yes", "2" = "No")
var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteYN) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") +
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Yes 489 81.36
No 101 16.81
NA 11 1.83

When did you move to Canada?

#move_can 

w2$move_can[w2$move_can==-7] <- NA
ggplot(w2, aes(x = w2$move_can)) + geom_histogram (na.rm=TRUE, binwidth = 1, fill="#76D24A") + xlab("Year of move to Canada")

summary(w2$move_can)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    1957    1992    2004    2000    2012    2020     500

To which ethnic or cultural group(s) do you belong? (Check all that apply)

var_name <- w2$group
w2$var_name_f <- as.factor(var_name)
var_name_f <- w2$var_name_f


##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") + guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") + 
  facet_wrap(~croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
White 506 84.19
South Asian 4 0.67
Chinese 10 1.66
Black 7 1.16
Latin American 9 1.50
Arab 7 1.16
Southeast Asian 5 0.83
Japanese 1 0.17
Other 1 0.17
Mixed identity 29 4.83
I don’t know/ prefer not to answer 10 1.66
NA 12 2.00

Which category best describes your annual household income, taking into account all sources of income?

#w2$income[w2$income==-7] <- NA

var_name <- w2$income 

w2$var_name_f <- recode_factor(var_name, "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", "-7" = "NA")

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = rev(INTERACTfade)) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") + 
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
No income 1 0.17
$1 to $9,999 9 1.50
$10,000 to $14,999 14 2.33
$15,000 to $19,999 14 2.33
$20,000 to $29,999 30 4.99
$30,000 to $39,999 33 5.49
$40,000 to $49,999 46 7.65
$50,000 to $99,999 177 29.45
$100,000 to $149,999 103 17.14
$150,000 to $199,999 80 13.31
$200,000 or more 33 5.49
Don’t know/prefer no answer 61 10.15

To what extent does this annual household income allow you to satisfy your household’s needs?

#income_needs

var_name <- w2$income_needs

w2$var_name_f <- recode_factor(var_name, "1" = "Very well", "2" = "Well", "3" = "Not so well", "4" = "Not at all", "77" = "Don't know/prefer no answer")

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTshortfade) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") + 
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Very well 248 41.26
Well 268 44.59
Not so well 66 10.98
Not at all 9 1.50
Don’t know/prefer no answer 10 1.66

What are your houshold’s total monthly housing costs?

This includes rent payments, mortgage payments, property taxes, condominium fees, and utility payments, like heating, water and electricity. If you live with roommates, please only include your share of the housing costs.

#housing costs 

w2$housing_cost[w2$housing_cost==-7] <- NA

#ggplot(w_2, aes(x = housing_cost)) + geom_histogram (na.rm =TRUE, binwidth = 1, fill="#76D24A") + xlab ("Monthly housing costs") + facet_wrap(~ croise)

summary(w2$housing_cost)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##       0     775    1100    1298    1700   10000     136

What is your highest education level?

#education

var_name <- w2$education

w2$var_name_f <- recode_factor(var_name, "1" = "Primary/Elementary school", "2" = "Secondary school", "3" = "Trade/Technical school or college diploma", "4" = "University degree", "5" = "Graduate degree", "77" ="I don't know/Prefer not to answer")

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteSet) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") + 
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Secondary school 32 5.32
Trade/Technical school or college diploma 92 15.31
University degree 218 36.27
Graduate degree 256 42.60
I don’t know/Prefer not to answer 3 0.50

What is your current employment status?

#employment
var_name <- w2$employment

w2$var_name_f <- recode_factor(var_name, "1" = "Retired and not working", "2" = "Employed full-time", "3" = "Employed part-time", "4" = "Unemployed and looking for work", "5" = "Unemployed and not looking for work", "6" ="Other" )

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPaletteSet) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") + 
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
Retired and not working 136 22.63
Employed full-time 290 48.25
Employed part-time 59 9.82
Unemployed and looking for work 22 3.66
Unemployed and not looking for work 22 3.66
Other 72 11.98

Which of the following best describes your usual work schedule at your current job?

#shift 
w2$shift[w2$shift==-7] <- NA

var_name <- w2$shift

w2$var_name_f <- recode_factor(var_name, "1" = "A regular daytime schedule or shift.", "2" = "A regular evening shift   ", "3" = "A regular night shift", "4" = "A rotating shift, a split shift, or an irregular schedule", "5" = "On call or casual", "6" ="Other") 

var_name_f <- w2$var_name_f

##### Table
t_1 <- w2 %>%
          group_by(croise, var_name_f) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))

##### Figure
p <- ggplot(t_1, aes(var_name_f,  y = pct, fill = var_name_f)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalettecont) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") + 
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise var_name_f n pct
A regular daytime schedule or shift. 282 46.92
A regular evening shift 6 1.00
A regular night shift 3 0.50
A rotating shift, a split shift, or an irregular schedule 31 5.16
On call or casual 13 2.16
Other 14 2.33
NA 252 41.93

How has the COVID-19 pandemic impacted your job?

w2$employment_covid_1[w2$employment_covid_1==0] <- 2
w2$employment_covid_2[w2$employment_covid_2==0] <- 2
w2$employment_covid_3[w2$employment_covid_3==0] <- 2
w2$employment_covid_4[w2$employment_covid_4==0] <- 2
w2$employment_covid_5[w2$employment_covid_5==0] <- 2
w2$employment_covid_6[w2$employment_covid_6==0] <- 2
w2$employment_covid_7[w2$employment_covid_7==0] <- 2
w2$employment_covid_8[w2$employment_covid_8==0] <- 2
w2$employment_covid_9[w2$employment_covid_9==0] <- 2
w2$employment_covid_10[w2$employment_covid_10==0] <- 2
w2$employment_covid_99[w2$employment_covid_99==0] <- 2

t_1 <- select(w2, croise, employment_covid_1,employment_covid_2, employment_covid_3, employment_covid_4, employment_covid_5, employment_covid_6, employment_covid_7, employment_covid_8, employment_covid_9, employment_covid_10)
t_1 <- pivot_longer(t_1,
   cols = starts_with("employment_covid_"),
   names_to = "feature",
   names_prefix = "employment_covid_",
   values_to = "values",
   values_drop_na = TRUE)

t_1$values <- recode_factor(t_1$values, "1" = "Yes", "2" = "No", "77" = "I don't know")


## rename 
t_1$feature[t_1$feature== "1"] <- "I work from home."
t_1$feature[t_1$feature== "2"] <- "I work partly from home, partly at my normal workplace"
t_1$feature[t_1$feature== "3"] <- "I continue to work at my normal place of work."
t_1$feature[t_1$feature== "4"] <- "My paid work #hours have been reduced."
t_1$feature[t_1$feature== "5"] <- "My hourly rate has been reduced"
t_1$feature[t_1$feature== "6"] <- "My paid work hours have increased" 
t_1$feature[t_1$feature== "7"] <- "My hourly rate has increased."
t_1$feature[t_1$feature== "8"] <- "My job has been deemed essential by the government."
t_1$feature[t_1$feature== "9"] <- "I lost my job"
t_1$feature[t_1$feature== "10"] <-"I have started a new job"


t_1 <- t_1 %>% 
  group_by(croise, feature, values) %>% 
  dplyr::summarise(n = n()) %>%
  dplyr:: mutate(pct = round(100*n/sum(n),2))

p <- ggplot(t_1, aes(x= feature, y= pct, fill= values)) + theme(axis.text.x = element_text(angle=0, vjust = .6)) + 
  geom_bar(stat= "identity") +
     coord_flip() +
  scale_fill_manual(values = INTERACTPaletteYN) +
      ylab("Percent") +
      xlab("Response") + 
    facet_wrap(~ croise) + 
  scale_x_discrete(labels = function(feature) str_wrap(feature, width = 30)) 

plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise feature values n pct
I continue to work at my normal place of work. Yes 82 13.64
I continue to work at my normal place of work. No 519 86.36
I have started a new job Yes 29 4.83
I have started a new job No 572 95.17
I lost my job Yes 45 7.49
I lost my job No 556 92.51
I work from home. Yes 205 34.11
I work from home. No 396 65.89
I work partly from home, partly at my normal workplace Yes 89 14.81
I work partly from home, partly at my normal workplace No 512 85.19
My hourly rate has been reduced Yes 7 1.16
My hourly rate has been reduced No 594 98.84
My hourly rate has increased. Yes 14 2.33
My hourly rate has increased. No 587 97.67
My job has been deemed essential by the government. Yes 73 12.15
My job has been deemed essential by the government. No 528 87.85
My paid work #hours have been reduced. Yes 42 6.99
My paid work #hours have been reduced. No 559 93.01
My paid work hours have increased Yes 14 2.33
My paid work hours have increased No 587 97.67

Age

# Categorize age variable
## reviens-y

w2$age_cat <- NA

w2$age_cat[w2$age  %in% c(18:24)] <- "18-24"
w2$age_cat[w2$age  %in% c(25:34)] <- "25-34"
w2$age_cat[w2$age  %in% c(35:44)] <- "35-44"
w2$age_cat[w2$age  %in% c(45:54)] <- "45-54"
w2$age_cat[w2$age  %in% c(55:64)] <- "55-64"
w2$age_cat[w2$age  %in% c(65:74)] <- "65-74"
w2$age_cat[w2$age  %in% c(75:100)] <- "75+"


##### Table
t_1 <- w2 %>%
          group_by(croise, age_cat) %>%
            dplyr::summarise(n = n()) %>%
            dplyr:: mutate(pct = round(100*n/sum(n),2))


p <- ggplot(t_1, aes(age_cat,  y = pct, fill = age_cat)) + theme(axis.text.x = element_text(angle=90, vjust = .6)) + 
  geom_bar(stat= "identity") +
  scale_fill_manual(values = INTERACTPalettecont) +
  guides(fill=FALSE) +
      ylab("Percent") +
      xlab("Response") + 
  facet_wrap(~ croise)
plot(p)

kable(t_1)  %>%   kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
croise age_cat n pct
18-24 29 4.83
25-34 114 18.97
35-44 116 19.30
45-54 109 18.14
55-64 126 20.97
65-74 82 13.64
75+ 24 3.99
NA 1 0.17