Changing Seasons

Opened the xls workbook and saved the active sheet as a csv.

setwd("~/Dropbox/OtherProjects")
Mort.df = read.csv("MortData.csv", header = TRUE)
Mort.df = Mort.df[, 1:13]
head(Mort.df)
##                                X Jan Feb March April May June July Aug
## 1           Akron-Canton Airport   0   0     0     0  -3  -23  -24   8
## 2        Albuquerque Int Airport   0   0     0    -6 -76  -83    0  17
## 3        Allentown International   0   0     0    -1   3  -69  -27 101
## 4 Amarillo International Airport  -1  -2    -2   -37 -93  -98   -1  12
## 5      Anchorage Int Airport 70+   0   0     0     0  -2   -9  -21  44
## 6 Atlanta Hartsfield Int Airport   0   0     0    -2 -79  -50   31  67
##   Sept Oct Nov Dec
## 1   -4  -1   0   0
## 2   74  40   0   0
## 3   39   3   0   0
## 4   89  34  13   2
## 5    6   0   0   0
## 6  150  43   0   0

The integers indicate the difference in the number of days of 85 or higher.

1950 through 1969 and 1990 through 2009 in which the daily maximum temperature was 85 or higher, and then determined the difference in number between the two periods.

The table gives the difference by month and for the two total periods. A minus figure means that the number of days in the 1950-69 period exceeded that of the 1990-2009 period. The opposite is true if the figure was positive.

Airports are ordered alphabetically. Sort by September differences.

Mort.df$X = with(Mort.df, reorder(X, Sept))
Wide = Mort.df[order(Mort.df$Sept), ]

Wide to long

require(reshape2)
## Loading required package: reshape2
Long = melt(Wide)
## Using X as id variables
require(ggplot2)
## Loading required package: ggplot2
ggplot(Long, aes(variable, X)) + geom_tile(aes(fill = value), colour = "white") + 
    scale_fill_gradient(low = "orange", high = "steelblue") + theme_bw() + xlab("") + 
    ylab("")

plot of chunk plot1

Milwaukee data

MKE.df = read.table("MKE85plus.txt", header = TRUE)
head(MKE.df)
##          Date X1950.59 X1960.69 X1970.79 X1980.89 X1990.99 X2000.09
## 1 April 16-30        0        2        0        3        1        4
## 2    May 1-15        5        2        1        2        5        2
## 3   May 16-31        8       10        7        6       10        3
## 4   June 1-15       23       19       12       17       12        8
## 5  June 16-30       38       32       24       36       36       20
## 6   July 1-15       43       42       41       37       45       35
dd = factor(MKE.df$Date)
# levels(dd)
dd = factor(dd, levels(dd)[c(1, 8, 9, 6, 7, 4, 5, 2, 3, 12, 13, 10, 11)])
MKE.df$Date = dd
Long2 = melt(MKE.df)
## Using Date as id variables

Plot MKE data

ggplot(Long2, aes(variable, Date)) + geom_tile(aes(fill = value), colour = "white") + 
    scale_fill_gradient(low = "white", high = "tomato") + theme_bw() + xlab("") + 
    ylab("") + scale_y_discrete(limits = rev(levels(Long2$Date))) + scale_x_discrete(breaks = c("X1950.59", 
    "X1960.69", "X1970.79", "X1980.89", "X1990.99", "X2000.09"), labels = c("1950-59", 
    "1960-69", "1970-79", "1980-89", "1990-99", "2000-09"))

plot of chunk plot2