[R] Clarification about data/weekday conversion

David Winsemius dwinsemius at comcast.net
Wed Jun 3 06:38:51 CEST 2015


On Jun 2, 2015, at 3:31 PM, t.k. t.k. wrote:

> Hi everyone
> This is a general question.
> I have imported a "Dates" variable as character. I used the "as.Date"
> command and convert it to Date,format..
> 
> I want to change the display of the date to weekday (e.g., I want my time
> series to be instead of 15-04-2010 as Friday-04-2010). I used the "format"
> command but the variable reverts back to character. Is there a way to
> change the day to weekday and my variable remain a "Date,format..."
> variable?
> 

Short answer: No. 
Longer answer: You _could_ define a new class which was named differently, but inherited from the Date class and make a print method for the new class. No guarantee about R time-series. That is a class with its own little universe. Seems to have dimensions that defy my understanding. Less comprehensible to me than the electron spin. But perhaps you meant something different than "time series"? Perhaps time sequence?



> these are the two lines I used as code
> 
> Hpc$Date1<- as.Date(Hpc$Date, "%d/%m/%Y")
> 
> Hpc$Date1<-format(Hpc$Date1, "%a %b %d %Y")
> 
> thanks in advance
> 
> 	[[alternative HTML version deleted]]
> 

And you _could_ learn to post in plain text.

-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list