[R] How to use as.Date (or something else) with "31-Jul-2010 23:59:00"
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Jul 27 01:30:42 CEST 2011
On Tue, Jul 26, 2011 at 7:18 PM, Eduardo Mendes <emammendes at gmail.com> wrote:
> Hello again
>
> I do apologize for the previous email without any useful information that
> can lead to an answer. To those who felt offended by "to no avail", I do
> apologize again. I guess I will be always a newbie as far as R is
> concerned.
>
>
> The date format was wrong and although I have tried to use different formats
> I could not get the result I wanted. So I went back to the file and changed
> to a format that R can understand (Please understand that R is very likely
> to have package that I might be unaware of). Now all dates are
>
>> class(data$TempDate)
> [1] "POSIXct" "POSIXt"
>> data$TempDate[1:2]
> [1] "2010-06-27 00:00:00 BRT" "2010-06-27 00:01:00 BRT"
>
> If I issue the command as.Date(data$TempDate[2]), the information on hour,
> minute and second is lost
>
> as.Date(data$TempDate[2])
> [1] "2010-06-27"
>
> If I use data$TempDate in a zoo object, I got the following msg
>
> some methods for "zoo" objects do not work if the index entries in 'order.by'
> are not unique
>
> If I issue plot(zoo object), the result is a mess since many values do not
> have an unique entry (as expected).
>
> How can I use the information on data$TempDate to create unique indexes for
> zoo objects and the like?
>
Read R News 4/1 and its references to find out about R's date time
classes and then read the 5 vignettes (PDF documents) that come with
zoo for many examples.
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list