Hi tk.tk., Once you have the date as a Date object, leave it that way for your time series analysis. If you want to get labels (as opposed to date values) in the format you request, do this:
date1<-"3/6/2015" Date1<-as.Date(date1,"%d/%m/%Y") [1] "2015-06-03" # get a character date in the <long weekday>-<numeric month>-<long year> format format(Date1,"%A-%m-%Y") [1] "Wed-06-2015" Jim On Wed, Jun 3, 2015 at 8:31 AM, t.k. t.k. <tk9...@gmail.com> 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? > > 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]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.