Great Circles, Black Holes, and Community Events Part 3 of 3

September 14, 2012

(This article was first published on OutLie..R, and kindly contributed to R-bloggers)

The second community event is the Soldier Hollow Junior Olympics (SoHo), again found in the Heber Valley area. Building upon the previous posts (part 1 and part 2) this one will show an event that has more people coming from greater distance. Take the bar charts for the number of participants and the cities they are from. Instead of 2 major cities (Heber Valley Railroad), SoHo has several cities and states with many participants for each.

The histogram for distance shows a similar pattern, where with the railroad it was a nice log looking distribution, this is a little more even. The second histogram is a zoomed in and the bins expanded for greater detail.

While the map is not as great as the railroad, which is why the distance histogram is so important, it does show a good representation of the northwestern states. Unlike the railroad map, each line does represent more participants than 3.

What makes this tool so great is the ability to visually show the interaction between distance, number of participants, and the draw of an event. The numbers are nothing really new, but the charts are what make this analysis shine. When talking to community representatives whose education range from high school graduate to PhD, pictures are critical.

#Soldier Hallow Analysis
soho<-read.csv(file.choose(), header=TRUE)
summary(soho)<-sort(table(soho$city), decreasing=TRUE)<-sort(table(soho$state), decreasing=TRUE)
par(mar=c(5, 11, 4, 2), las=2)
barplot(, main=‘SoHo: Cities’, horiz=TRUE, col=‘red’)
par(mar=c(5, 4, 4, 2), las=2)
barplot(, main=‘SoHo: States’, horiz=TRUE, col=‘red’)
heber<-c(-111.33259, 40.511413)<-matrix(data=c(soho$long, soho$lat), nrow=373, ncol=2)
soho.ut<-subset(soho, subset=(state==‘UT’))<-matrix(data=c(soho.ut$long, soho.ut$lat), nrow=29, ncol=2)
soho.dist<-(distm(heber,, fun=distVincentyEllipsoid)*0.000621371192)
soho.dist.ut<-(distm(heber,, fun=distVincentyEllipsoid)*0.000621371192)
dist.soho<-matrix(soho.dist, nrow=373, ncol=1)
dist.soho.ut<-matrix(soho.dist.ut, nrow=29, ncol=1)
hist(dist.soho, main=‘SoHo: Distance Histogram, col=‘red’)
hist(dist.soho.ut, main=‘SoHo: Distance Histogram Utah’, breaks=20, col=‘red’)
#mapping it out
map("state", col="#f2f2f2", fill=TRUE, bg="white", lwd=0.25)
title(main=‘SoHo: US Map)
for(i in 1:dim([1]){
inter <- gcIntermediate(heber,[i, 1:2], n=373, addStartEnd=TRUE)
lines(inter, col="red")
#Zoomed into West
par(mfrow=c(1,2), mar=c(5,4,4,2))
map("state", col="#f2f2f2", fill=TRUE, bg="white", lwd=0.25, xlim=c(-125, -103), ylim=c(30, 50))
title(main=‘SoHo: Western Region’)
for(i in 1:dim([1]){
inter <- gcIntermediate(heber,[i, 1:2], n=373, addStartEnd=TRUE)
lines(inter, col="red")
map("state", col="#f2f2f2", fill=TRUE, bg="white", lwd=0.25, xlim=c(-112.1, -111), ylim=c(40, 42))
title(main=‘SoHo: Utah’)
for(i in 1:dim([1]){
inter <- gcIntermediate(heber,[i, 1:2], n=29, addStartEnd=TRUE)
lines(inter, col="red")

To leave a comment for the author, please follow the link and comment on their blog: OutLie..R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)