-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvmt-daily.qmd
More file actions
216 lines (155 loc) · 3.7 KB
/
vmt-daily.qmd
File metadata and controls
216 lines (155 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
---
title: "Daily Vehicle Miles Traveled (VMT)"
---
```{r}
#| include: false
source("setup.R")
data <- vmt_daily
# Helper function to create a chart for a given facet
make_chart <- function(data, facet_var, facet_value, line_var) {
chart_data <- data |>
filter(.data[[facet_var]] == facet_value)
chart_data |>
group_by(.data[[line_var]]) |>
e_charts(miles) |>
e_line(quantile, symbol = "none", smooth = FALSE) |>
e_tooltip(trigger = "axis") |>
e_x_axis(name = "DVMT") |>
e_y_axis(name = "Quantile") |>
e_legend(
show = TRUE,
orient = "horizontal",
left = "center",
bottom = 0,
width = "70%",
selector = list(
list(type = "all", title = "All"),
list(type = "inverse", title = "Inverse")
),
selectorPosition = "start"
) |>
e_grid(bottom = 100) |>
e_color(background = "transparent") |>
e_toolbox_feature(feature = "dataZoom") |>
e_toolbox_feature(feature = "saveAsImage")
}
```
This page shows the distribution of daily vehicle miles traveled (VMT) across all vehicles in the dataset. Each chart displays quantiles of daily mileage for a given combination of powertrain and vehicle type. For example, the 0.5 quantile represents the median daily mileage (half of vehicles drive less than this amount and half drive more). See the [about](about.html#vehicle-miles-traveled-vmt) page for more details.
## By Vehicle Type
*Click legend items to show/hide lines.*
::: {.grid}
::: {.g-col-6}
### Car
```{r}
make_chart(data, "vehicle_type", "Car", "powertrain")
```
:::
::: {.g-col-6}
### CUV
```{r}
make_chart(data, "vehicle_type", "CUV", "powertrain")
```
:::
::: {.g-col-6}
### SUV
```{r}
make_chart(data, "vehicle_type", "SUV", "powertrain")
```
:::
::: {.g-col-6}
### Pickup
```{r}
make_chart(data, "vehicle_type", "Pickup", "powertrain")
```
:::
::: {.g-col-6}
### Minivan
```{r}
make_chart(data, "vehicle_type", "Minivan", "powertrain")
```
:::
:::
## By Powertrain
*Click legend items to show/hide lines.*
::: {.grid}
::: {.g-col-6}
### Gasoline
```{r}
make_chart(data, "powertrain", "Gasoline", "vehicle_type")
```
:::
::: {.g-col-6}
### Flex Fuel (E85)
```{r}
make_chart(data, "powertrain", "Flex Fuel (E85)", "vehicle_type")
```
:::
::: {.g-col-6}
### Hybrid Electric (HEV)
```{r}
make_chart(data, "powertrain", "Hybrid Electric (HEV)", "vehicle_type")
```
:::
::: {.g-col-6}
### Plug-In Hybrid Electric (PHEV)
```{r}
make_chart(data, "powertrain", "Plug-In Hybrid Electric (PHEV)", "vehicle_type")
```
:::
::: {.g-col-6}
### Battery Electric (BEV)
```{r}
make_chart(data, "powertrain", "Battery Electric (BEV)", "vehicle_type")
```
:::
::: {.g-col-6}
### BEV (Tesla)
```{r}
make_chart(data, "powertrain", "BEV (Tesla)", "vehicle_type")
```
:::
::: {.g-col-6}
### BEV (Non-Tesla)
```{r}
make_chart(data, "powertrain", "BEV (Non-Tesla)", "vehicle_type")
```
:::
::: {.g-col-6}
### Diesel
```{r}
make_chart(data, "powertrain", "Diesel", "vehicle_type")
```
:::
::: {.g-col-6}
### Fuel Cell
```{r}
make_chart(data, "powertrain", "Fuel Cell", "vehicle_type")
```
:::
:::
## Data
<center>
<a href="`r url_vmt_daily`" style="display: inline-block; padding: 8px 16px; background-color: #0066cc; color: white; text-decoration: none; border-radius: 4px; margin-bottom: 10px;">Download data</a>
<div style="width:900px">
```{r}
data |>
mutate(
miles = round(miles, 2)
) |>
rename(
Powertrain = powertrain,
`Vehicle Type` = vehicle_type,
Quantile = quantile,
Miles = miles
) |>
reactable::reactable(
searchable = TRUE,
highlight = TRUE,
filterable = TRUE,
defaultPageSize = 10,
showPageSizeOptions = TRUE,
pageSizeOptions = c(5, 10, 25, 50)
)
```
</div>
</center>