Hi there, I have a problem, i have a dataset, in which there are time series from 2010- to 2014, like this: -2014-01-30 15:39:46 -2012-04-20 14:49:02 And so on . I want to have a situation in which there are days of week expressed in word, because I have to calculate days of week and on the other hand week end. For example, i want : -2014- 01 monday 15:39:46 -2012-04 saturday 14:49:02 Thanks guys Inviato da iPhone
This post should help http://stackoverflow.com/questions/9216138/find-the-day-of-a-week-in-r John Kane Kingston ON Canada> -----Original Message----- > From: cami090912 at icloud.com > Sent: Sat, 31 Jan 2015 10:06:08 +0100 > To: r-help at r-project.org > Subject: [R] R problem > > Hi there, > I have a problem, i have a dataset, in which there are time series from > 2010- to 2014, like this: > -2014-01-30 15:39:46 > -2012-04-20 14:49:02 > And so on . > I want to have a situation in which there are days of week expressed in > word, because I have to calculate days of week and on the other hand week > end. For example, i want : > -2014- 01 monday 15:39:46 > -2012-04 saturday 14:49:02 > Thanks guys > > Inviato da iPhone > ______________________________________________ > R-help at 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.____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account.
> ex <- strptime(c("2014-01-30 15:39:46", "2012-04-20 14:49:02"),format="%Y-%m-%d %H:%M:%S") > ex [1] "2014-01-30 15:39:46 CST" "2012-04-20 14:49:02 CST" > format(ex, format="%a") [1] "Thu" "Fri" > format(ex, format="%A") [1] "Thursday" "Friday" > weekdays(ex) [1] "Thursday" "Friday" > Is this what you are looking for? I hope this helps. Chel Hee Lee On 1/31/2015 3:06 AM, Camilla Timo wrote:> Hi there, > I have a problem, i have a dataset, in which there are time series from 2010- to 2014, like this: > -2014-01-30 15:39:46 > -2012-04-20 14:49:02 > And so on . > I want to have a situation in which there are days of week expressed in word, because I have to calculate days of week and on the other hand week end. For example, i want : > -2014- 01 monday 15:39:46 > -2012-04 saturday 14:49:02 > Thanks guys > > Inviato da iPhone > ______________________________________________ > R-help at 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. >