Message-ID: <1385652249.94695.YahooMailNeo@web142601.mail.bf1.yahoo.com>
Date: 2013-11-28T15:24:09Z
From: arun
Subject: date format
In-Reply-To: <52975E53.1070001@sapo.pt>
#Or
?paste(dat[,3],dat[,2],dat[,1],sep=".")
#[1] "4.1.2011" "5.2.2012" "6.3.2013"
#
?as.character(interaction(dat[,3:1]))
?paste(sprintf("%02d",dat[,3]),sprintf("%02d",dat[,2]),dat[,1],sep=".")
#[1] "04.01.2011" "05.02.2012" "06.03.2013"
A.K.
On Thursday, November 28, 2013 10:18 AM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
Hello,
Maybe something like the following.
dat <- data.frame(yyyy = 2011:2013, mm = 1:3, dd = 4:6)
apply(dat, 1, function(x) paste(rev(x), collapse = "."))
Hope this helps,
Rui Barradas
Em 28-11-2013 13:54, eliza botto escreveu:
> 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.
>
______________________________________________
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.