@@ -76,9 +76,26 @@ ggplot(rd %>%
7676 geom_text(aes(label = perc ), position = position_dodge(width = 0.9 ), vjust = - 0.25 , color = " blue" ) +
7777 theme_minimal() +
7878 theme(axis.text.x = element_text(angle = 90 , hjust = 1 )) +
79- labs(x = " " , y = " percentage(%)" , title = " Main Mode distribution" )
79+ labs(x = " " , y = " percentage(%)" , title = " Main Mode distribution - without weights " )
8080# )
8181
82+ sum_total_trip_weight <- sum(rd $ FE_VIA , na.rm = T )
83+
84+ # plotly::ggplotly(
85+ ggplot(rd %> %
86+ filter(! is.na(trip_mode )) %> %
87+ group_by(trip_mode ) %> %
88+ summarise(sum_trip_weights = sum(FE_VIA )) %> %
89+ mutate(perc = round(sum_trip_weights / sum_total_trip_weight * 100 , 1 )),
90+ aes(x = trip_mode , y = perc )) +
91+ geom_bar(position = ' dodge' , stat = ' identity' ) +
92+ geom_text(aes(label = perc ), position = position_dodge(width = 0.9 ), vjust = - 0.25 , color = " blue" ) +
93+ theme_minimal() +
94+ theme(axis.text.x = element_text(angle = 90 , hjust = 1 )) +
95+ labs(x = " " , y = " percentage(%)" , title = " Main Mode distribution - with weights" )
96+ # )
97+
98+
8299
83100# Define distance categories
84101dist_cat <- c(" 0-6 km" , " 7-9 km" , " 10+ km" )
@@ -99,4 +116,23 @@ ggplot(rd %>%
99116 geom_text(aes(label = perc ), position = position_dodge(width = 0.9 ), vjust = - 0.25 , color = " blue" ) +
100117 theme_minimal() +
101118 theme(axis.text.x = element_text(angle = 90 , hjust = 1 )) +
102- labs(x = " " , y = " percentage(%)" , title = " Main Mode Distance distribution" )
119+ labs(x = " " , y = " percentage(%)" , title = " Main Mode Distance distribution" )
120+
121+
122+ # source_modes <- c('Bus', 'Walking')
123+ # target_modes <- c('Private Car')
124+ #
125+ # source_percentages <- c(0.16, 0.49)
126+ #
127+ # tt <- nrow(filter(rdr, ! trip_mode %in% c('99', 'Short Walking')))
128+ #
129+ # rdr <- create_scenario(rdr, scen_name = 'Scenario 1', source_modes = source_modes,
130+ # target_modes = target_modes, source_distance_cats = dist_cat,
131+ # source_trips = c(round(source_percentages[1] * tt),
132+ # round(source_percentages[2] * tt)))
133+ #
134+ # rdfinal <- rbind(rd, rdr)
135+
136+ # rdr %>% filter(rdfinal, scenario == 'Scenario 1' & ! trip_mode %in% c('Short Walking', "99", "Train", "Other", "Unspecified")) %>%
137+ # group_by(trip_mode) %>% summarise(count = n(), pert = n() / nrow(.) * 100)
138+
0 commit comments