[R] date format

arun smartpink111 at yahoo.com
Thu Nov 28 16:10:26 CET 2013


Hi,
Try:
dat1 <- data.frame(years=rep(1991:1992,12), months=rep(1:12,2),days= rep(1,24))
 dat1$day <- format(as.Date(paste(dat1[,1],sprintf("%02d",dat1[,2]),sprintf("%02d",dat1[,3]),sep="."),"%Y.%m.%d"),"%d.%m.%Y")
A.K.




On Thursday, November 28, 2013 8:56 AM, eliza botto <eliza_botto at hotmail.com> wrote:
Dear Users of R,
I have a data frame with three column, the first column contains years, the second one months and third one, the days (cbind(yyyy mm dd)). I want to combine them so that i have one column with the date format as (dd.mm.yyyy).
Is there a way of doing that.
Thanks in advance,
Eliza                           
    [[alternative HTML version deleted]]

______________________________________________
R-help at 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.




More information about the R-help mailing list