Hi Raging Jim

may be this is a starting point.

myDF<-read.table(stdin(),head=T,sep=",")
yyyymm,Rainfall
1977-02,17.4
1977-03,34.0
1977-04,26.2
1977-05,42.6
1977-06,58.6
1977-07,23.2
1977-08,26.8
1977-09,48.4
1977-10,47.0
1977-11,37.2
1977-12,15.0
1978-01,2.6
1978-02,6.8
1978-03,9.0
1978-04,46.6

myDF$yyyy<-substr(myDF$yyyymm,1,4)
myDF$mm<-substr(myDF$yyyymm,6,7)
myDF<-subset(myDF, select=c(yyyy,mm,Rainfall))
myDF.reshape<-reshape(myDF,v.names="Rainfall",idvar="yyyy",
 timevar="mm",direction="wide")
myDF.reshape
best regards

milton

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to