Skip to content
Prev 333804 / 398506 Next

date format

#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:

            
______________________________________________
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.