Skip to content
Branch: master
Find file History
Pull request Compare This branch is 7 commits behind 52vis:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
codes and data


I have extracted the names of Law Enforcement officer from text data(EventREPORTNARRATIVE column) by tokenizing text data using tokenizers package

Most of the reports (not all) follows a specific pattern :" LEOS NOTIFIED." , "PHOENIX PD NOTIFIED." etc. So I used tokenizers package to split these text data and get sentences which have 'NOTIFIED' word in it. All LEO are not extracted using this method as all reports doesn't follow this pattern. I was able to extract 1007 LEO names out of 1347(total data size). Resulting LEO names are still very unstructured. I had to manually change few entries to make data more consistent.(So that I will have less factor levels.)

##loading libraries

xl1 <- read_excel("UAS_Sightings_report_21Aug-31Jan.xlsx")
xl2 <- read_excel("UASEventsNov2014-Aug2015.xls")
drones$month = factor(drones$month,levels(drones$month)[c(5,4,8,1,9,7,6,2,12,11,10,3)])

drones2$month = factor(drones2$month,levels(drones$month)[c(5,4,8,1,9,7,6,2,12,11,10,3)])

by_state <- drones2[drones2$class=="NOTIFIED",] %>%
  group_by(state) %>%
  summarize(count = n()) %>%  mutate(region = tolower(state))

missing_states <- data_frame(
  region = c("wyoming", "vermont", "nebraska", "iowa","idaho","north dakota","south dakota"),
by_state <- bind_rows(by_state, missing_states)

us <- map_data("state")

mid <- mean(by_state$count, na.rm = TRUE) 
p=ggplot(data=drones) + 
 geom_bar(mapping=aes(x=hour,fill="red"))+ggtitle("Hourly classification of UAS")+ylab("# UAS sightings")+ scale_fill_discrete("",labels="",breaks="")

drones sightingds are very high at midnight (near 12 AM) and very low in early morining.

p=ggplot(data = drones[!$month),]) + 
  geom_bar(mapping = aes(x = month,fill=hour_class),position="fill")+ggtitle("Classify Monthly UAS sightings on the basis of day and night time")+xlab("# UAS sightings")+theme(axis.text.x = element_text(angle = 90, hjust = 1))

I have considered 7 AM to 6PM as Day time and 7 Pm to 6 AM as Night time. The reason sightings in august and September is very high in night time due to spring (that's my guess).

p=ggplot() + 
  geom_map(aes(x = long, y = lat, map_id = region), data = us,
           map = us,fill="gray",color="white") + 
  geom_point(mapping = aes(x=lon,y=lat,color=hour_class,frame=month),data=subset(drones2,lon>= min(us$long) & lon<=max(us$long) &   lat>= min(us$lat) & lat<=max(us$lat)  ),size=5,alpha=0.7)+
  ggtitle("UAS occurences month : ")+theme_light()

ani.options(interval = 1, ani.width = 800, ani.height = 800)
gg_animate(p,"monthly UAS occurences.gif")

p=ggplot(data = drones2) + 
  geom_bar(mapping = aes(x = class,fill=class))+ggtitle("Whether UAS was notified to LEO or not")

Large number of cases are notified to nearby LEOs. Very few cases are not notified.

p=ggplot(data = drones2[1:nrow(xl2),]) + 
  geom_bar(mapping = aes(x = class,fill=class)) +ggtitle("UASEventsNov2014-Aug2015")

p=ggplot(data = drones2[(nrow(xl2)+1):nrow(drones2),]) + 
  geom_bar(mapping = aes(x = class,fill=class)) +ggtitle("UAS_Sightings_report_21Aug-31Jan")

p=ggplot(data=drones2) +
  geom_bar(mapping = aes(x=state,fill=class))+ ggtitle("Stateweise classification")+theme(axis.text.x = element_text(angle = 90, hjust = 1))

California has very high number of drone sightings.Unknown cases (don't know whther they are notified or not) and not notified cases are also high in california. Other than California, Florida and New York has high drone sightings.

p=ggplot(data=drones2[drones2$yw>=201500 & drones2$yw<=201570,]) + 
  geom_bar(mapping=aes(x=yw,fill=class))+ggtitle("Weekly classification in year 2015")

p=ggplot() +
  geom_map(aes(x = long, y = lat, map_id = region), data = us,
           map = us, fill = "#ffffff", color = "#ffffff", size = 0.15) +
  geom_map(aes(fill = count, map_id = region),
           map = us, data = by_state,
           color = "#ffffff", size = 0.15)+ggtitle("UAS map")

p=ggplot() + 
geom_map(aes(x = long, y = lat, map_id = region), data = us,
         map = us,fill="gray",color="white") + 
    geom_point(mapping = aes(x=lon,y=lat,color=class,frame=yw),data=subset(drones2,lon>= min(us$long) & lon<=max(us$long) &   lat>= min(us$lat) & lat<=max(us$lat)  ),size=7)+theme_light()+ggtitle("Weekly UAS occurences")

ani.options(interval = 0.5, ani.width = 800, ani.height = 800)
gg_animate(p,"weekly UAS occurences.gif")


You can’t perform that action at this time.