[R] difficulty in Formatting time series data

R. Michael Weylandt michael.weylandt at gmail.com
Sun Apr 22 19:13:47 CEST 2012


Yes.... dput() for a reproducible example with some minimal
reproducible code (and the packages "day.of.week" and wday() come
from...)

x <- xts(10, Sys.Date())
wday(x)

seems fine for me.

"precisely the wrong answers"  -- interesting turn of phrase.

Michael

On Sun, Apr 22, 2012 at 12:53 PM, Raghuraman Ramachandran
<optionsraghu at gmail.com> wrote:
> Dear R-Gurus
>
> I have a data frame (from CSV file) which has its first column called Date.
> The Date is in the format mm/dd/yyyy. I was trying to get the weekday for
> these dates and I tried using wday() and day.of.week() functions and both
> of them gave me precisely the wrong answers. I think the issue lies in the
> proper formatting of dates. The class of this column is a factor class and
> hence I tried converting into POSIXlt, xts, zoo objects and yet I could not
> get the weekday correctly. Anyone has any suggestions please?
>
> Many thanks
> Raghu
>
>        [[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.



More information about the R-help mailing list