Re: [R] month and output

2016-05-07 Thread Ashta
Thank you David! On Sat, May 7, 2016 at 12:18 AM, David Winsemius wrote: > >> On May 6, 2016, at 5:15 PM, Ashta wrote: >> >> Thank you very much David. >> >> So there is no general formal that works year all round. >> >> The first one work only Jan to Nov >> today <- Sys.Date() >> nextmo<- paste

Re: [R] month and output

2016-05-06 Thread David Winsemius
> On May 6, 2016, at 5:15 PM, Ashta wrote: > > Thank you very much David. > > So there is no general formal that works year all round. > > The first one work only Jan to Nov > today <- Sys.Date() > nextmo<- paste0( month.abb[ as.numeric(format(today, format="%m"))+1] , > format

Re: [R] month and output

2016-05-06 Thread William Dunlap via R-help
You could install and load the 'lubridate' package, which has month() and month<-() functions so you can do the following: > z <- as.Date(c("2015-01-29", "2016-01-29", "2016-05-07", "2016-12-25")) > z [1] "2015-01-29" "2016-01-29" "2016-05-07" "2016-12-25" > month(z) <- month(z) + 1 > z [1] NA

Re: [R] month and output

2016-05-06 Thread Ashta
Thank you very much David. So there is no general formal that works year all round. The first one work only Jan to Nov today <- Sys.Date() nextmo<- paste0( month.abb[ as.numeric(format(today, format="%m"))+1] , format(today,"%Y") ) [1] "Jun2016" The second one works only for th

Re: [R] month and output

2016-05-06 Thread Bert Gunter
To add to what David said, maybe you want ?sink or ?capture.output . If you're really looking to combine your own text and R output, than knitr is probably what you want. The RStudio ide integrates this stuff, so you may want to look at that, too. Cheers, Bert Bert Gunter "The trouble with hav

Re: [R] month and output

2016-05-06 Thread David Winsemius
> On May 6, 2016, at 4:30 PM, David Winsemius wrote: > > >> On May 6, 2016, at 4:11 PM, Ashta wrote: >> >> Hi all, >> >> I am trying to ge get the next month of the year. >> >> today <- Sys.Date() >> xx<- format(today, format="%B%Y") >> >> I got "May2016", but I want Jun2016. How do I d

Re: [R] month and output

2016-05-06 Thread David Winsemius
> On May 6, 2016, at 4:11 PM, Ashta wrote: > > Hi all, > > I am trying to ge get the next month of the year. > > today <- Sys.Date() > xx<- format(today, format="%B%Y") > > I got "May2016", but I want Jun2016. How do I do that? today <- Sys.Date() nextmo<- paste0( month.abb[ as.numeric(fo

[R] month and output

2016-05-06 Thread Ashta
Hi all, I am trying to ge get the next month of the year. today <- Sys.Date() xx<- format(today, format="%B%Y") I got "May2016", but I want Jun2016. How do I do that? My other question is that, I read a data and do some analysis and I want to send all the results of the analysis to a pdf f