Skip to content
Prev 360738 / 398502 Next

month and output

It occurred to me that at the end of the year you would want to increment the year as well. This calculates the next month and increments the year value if needed:

 today <- as.Date("2008-12-01")
 nextmo<- paste0(m <- month.abb[(as.numeric(format(today, format="%m"))+1) %/% 12] , 
                  as.numeric( format(today,"%Y") ) + (m == "Jan") )
 nextmo
#[1] "Jan2009"
If you need to suppress the axes and their labels:

 pdf(file=" test.pdf"); plot(1,1, type="n", axes=FALSE, xlab="", ylab="")
 text(1, 1, paste(round(x5, 2), collapse="\n") )
 dev.off()
David Winsemius
Alameda, CA, USA