[R] date format conversion problem
bolker at ufl.edu
Wed Oct 10 20:14:35 CEST 2007
Joao Santos-7 wrote:
> I problem is in the format of the date, my time series is like this:
> When I attempt to format the time like this:
> A <- read.table("file", sep="\t", col.names=c("date", "my1", "my2",
> temp <- as.Date(A$date, format="%Y%m%d%H")
> I get
>  "4403-05-21" "4403-05-22" "4403-05-23" "4403-05-24" "4403-05-25"
> [snip ...]
I saved your data (in a space-separated format rather than
tab-separated, but that shouldn't matter)
A <- read.table("timeser.dat",
col.names=c("date", "my1", "my2", "my3"))
temp <- as.Date(as.character(A$date), format="%Y%m%d%H")
Oddly enough, when I do
Error in as.Date.default(A$date) :
do not know how to convert 'A$date' to class "Date"
rather than a nonsensical answer -- what version of R
are you using? (e.g. what are the results of sessionInfo() ?)
Although it looks like the results you get might be the results of
translating numeric directly into a date ... ?
[thanks for the reproducible example, but (1) R version and
(2) meaningful subject line would be nice. Also, good to specify
that regul() is from the pastecs package ]
View this message in context: http://www.nabble.com/%28no-subject%29-tf4602032.html#a13141435
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help