Exploratory analysis of hurricane data

I have been doing a lot of exploration with ggplot2 and my hurricane dataset.

This map was made using some code I posted previously. I just added some additional stuff to make this specific plot.  You will have to go through the entire data collection process from the previous post in order to append this code below.

data <- read.csv("C:/Documents and Settings/165180/Desktop/code/hurricane.csv") #you will have to get this through the previous post!
data$name.year <- paste(data$year, data$name)


map <- get_map(location = c(lon = -80, lat = 30), zoom = 4)
p <- ggmap(map)

july <- data[data$month == 7, ]

july$type <- rep(0, nrow(july))

july$type[which(july$STAT == "HURRICANE-1" | july$STAT == "HURRICANE-2" | july$STAT == "HURRICANE-3" | july$STAT == "HURRICANE-4")] <- "HURRICANE"

ddply(july, .(name.year), function(x){any(x == "HURRICANE")})

#I want the stat to be either hurricane or x. so I can plot.
july$STAT <- revalue(july$STAT, c("DEPRESSION (ESTIMATE"="x", "DISSIPATED"="x",
"LOW" = "x",
"TROPICAL WAVE" = "x", "XXX" = "x"))

cbPalette <- c("#d4b9da", "#91003f", "#df65b0", "#e7298a", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
p + geom_path(data = july, aes(LON, LAT, group = name.year), size = 1, col="grey") +
geom_point(data = july, aes(LON, LAT, col = STAT), pch=18, size = 4) +
scale_colour_manual(values=cbPalette) +
ggtitle("July storms since 1851") +
theme(plot.title = element_text(size = rel(2)))

july storms

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: