The raw data (for Leeds City Centre) is available here. A network of CCTV cameras is used to track the number of people passing through an area per hour. The data is provided in the form of csv files. As an example I am taking one file for September 2014. I wrote and ran the R commands on the command line rather than in RStudio.
The first step is to read the data into memory. Since I saved the data file in my working directory (you can get this using the function getwd()) I can just use the read.csv() function and pass in the name of the file:
myData <- read.csv("monthly-data-feed-sept-2014-20141009.csv")
The next step is to extract the data just for one location, in this case the data for Briggate
brigData <- myData[myData$LocationName == "Briggate",]
Then I can narrow this data down to Monday
brigData_Mon <- brigData[brigData$Weekday == "Monday",]
The data can now be plotted:
Pedestrians per hour, Friday (Sep 2014)
I produced similar charts for the other days of the week. R can also produce summary statistics for the data
Summary data such as max and min values for particular days can be obtained from:
max(brigData_Mon$InCount) and min(brigData_Mon$InCount)
This blog includes:
Scripts mainly in Python with a few in R covering NLP, Pandas, Matplotlib and others. See the home page for links to some of the scripts. Also includes some explanations of basic data science terminology.