<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/dft-traffic-count-data-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://scottishsnow.wordpress.com/2018/01/26/dft-traffic-count-data-in-r/"> R – scottishsnow</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>I read <a rel="nofollow" href="https://twitter.com/cocteautriplets/status/955842616838557696" target="_blank">this tweet thread</a> yesterday, and one of the great things in it was discovering that the Department for Transport release <a rel="nofollow" href="https://www.dft.gov.uk/traffic-counts/" target="_blank">traffic count data for Great Britain</a>.</p>
<p>When you download individual observation locations you get a csv with a few years data. I checked out the one for a street near where I live using R (code at the bottom of this post):</p>
<div data-shortcode="caption" class="wp-caption"><a rel="nofollow" href="https://scottishsnow.files.wordpress.com/2018/01/the_loan.png" target="_blank"><img data-orig-file="https://scottishsnow.files.wordpress.com/2018/01/the_loan.png?w=456" data-orig-size="1021,600" data-medium-file="https://scottishsnow.files.wordpress.com/2018/01/the_loan.png?w=456?w=300" data-attachment-id="1547" data-image-meta="{" data-image-description="" src="https://scottishsnow.files.wordpress.com/2018/01/the_loan.png?w=456" data-permalink="https://scottishsnow.wordpress.com/2018/01/26/dft-traffic-count-data-in-r/the_loan/" data-large-file="https://scottishsnow.files.wordpress.com/2018/01/the_loan.png?w=456?w=620" alt="The_Loan" data-image-title="The_Loan" sizes="(max-width: 620px) 100vw, 620px" data-comments-opened="1" class="wp-image-1547" data-recalc-dims="1"></a>
<p class="wp-caption-text">Traffic count data for The Loan, Loanhead. Note the y scales vary with each plot.</p>
</div>
<p>The obvious thing to notice is the large jump in 2010. The data download also includes meta data for each year. Count observations were made in 2001 and in 2010 and all other years are estimated. I don’t know what the count frequency is in surrounding areas, but I can imagine infilling missing data is hard. However, it does look like the DfT model could do with some work, based on this anecdote <img alt="😉" src="https://i0.wp.com/s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f609.png?w=456&ssl=1" class="wp-smiley" data-recalc-dims="1"></p>
<p>Following download, the above plot was made using the following 10 lines of R code:</p>
<pre>
library(tidyr)
library(dplyr)
library(ggplot2)

x = read.csv(&quot;~/Downloads/80158.csv&quot;)

x %>%
   select(AADFYear, PedalCycles, Motorcycles, CarsTaxis, BusesCoaches, LightGoodsVehicles, AllHGVs) %>%
   gather(Vehicle, Count, -AADFYear) %>%
   ggplot(aes(AADFYear, Count)) +
   geom_point() +
   facet_wrap(~Vehicle, scales=&quot;free_y&quot;)
</pre>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://scottishsnow.wordpress.com/2018/01/26/dft-traffic-count-data-in-r/"> R – scottishsnow</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/W6NROXoG8zI" height="1"></a></div>