lat<-c("date",seq(-60,77,2.5)) #55
long<-seq(-177.5,180,2.5) #144
years<-seq(1870,2005)
months<-seq(1,12)
#reading the data
read.table("~/Downloads/pdsi.monthly.maps.1870-2005.fawc=1.r2.5x2.5.txt",fill=NA,nrows=length(years)*length(months)*length(lat),na.strings="-99.90")->palmer

names(palmer)<-long
palmer[145]<-rep(lat,length(years)*length(months))
palmer[146]<-sort(rep(years,length(lat)*length(months)))
palmer[147]<-rep(sort(rep(months,length(lat))),length(years))
names(palmer)[145:147]<-c("lat","year","month")
require(dplyr)
## Loading required package: dplyr
## 
## Attaching package: 'dplyr'
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
require(reshape2)
## Loading required package: reshape2
require(ggplot2)
## Loading required package: ggplot2
palmer %>% filter(month==1,year==2002) %>% melt(id="lat") %>% mutate(long=as.numeric(as.character(variable)),lat=as.numeric(lat)) ->jan2002
## Warning: attributes are not identical across measure variables; they will
## be dropped
## Warning in mutate_impl(.data, dots): NAs introduced by coercion
## Warning in mutate_impl(.data, dots): NAs introduced by coercion
qplot(long,lat,data=jan2002,shape=15,size=I(3),colour=value)+theme_bw()+scale_shape_identity()+scale_colour_discrete(guide=F)
## Warning in loop_apply(n, do.ply): Removed 256 rows containing missing
## values (geom_point).