> It is probably something blindingly simple but can
> anyone suggest something?

You need to use the format code "%Y" for 4-digits years.
You need to create a data frame using 'data.frame()' (cbind() creates a 
matrix when given just vectors).

 > as.Date(c("2005/01/24" ,"2006/01/23" ,"2006/01/23"), "%Y/%m/%d")
[1] "2005-01-24" "2006-01-23" "2006-01-23"
 > data.frame(int=1:3, date=as.Date(c("2005/01/24" ,"2006/01/23" 
,"2006/01/23"), "%Y/%m/%d"))
   int       date
1   1 2005-01-24
2   2 2006-01-23
3   3 2006-01-23
 > (x <- data.frame(int=1:3, date=as.Date(c("2005/01/24" ,"2006/01/23" 
,"2006/01/23"), "%Y/%m/%d")))
   int       date
1   1 2005-01-24
2   2 2006-01-23
3   3 2006-01-23
 > class(x)
[1] "data.frame"
 > sapply(x, class)
       int      date
"integer"    "Date"
 >

-- Tony Plate

______________________________________________
[email protected] 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.

Reply via email to