Hi Bill, You might be working too hard. Consider: > weekdays(as.Date('2010-11-30')) == "Monday" [1] FALSE > weekdays(as.Date('2010-11-29')) == "Monday" [1] TRUE >
HTH, Ista On Tue, Nov 30, 2010 at 9:40 PM, Bill Yang <gy631...@hotmail.com> wrote: > > Hi there, > I am having problem of matching string. what i want is when i type a date > such as 2010-11-30, the function will return the day (monday, tuesday, > wednesday, thursday, friday or staturday). then i want another function will > return true if the return of the day is monday, return false if the return of > the day is not monday. > I already find the weekdays(as.Date('2010-11-30')) function which will tell > me exactly what day its gonna be. however, i am having problem of return True > or False whether or not the return day has matched. > please help me out. I appreciate. > Bill > P.S the following is the partial > codes.if(match(weekdays(as.Date('2010-11-30'), "Monday")==1){print("yes")} > > > > r-help@r-project.org >> Subject: Welcome to the "R-help" mailing list >> From: r-help-requ...@r-project.org >> To: gy631...@hotmail.com >> Date: Wed, 1 Dec 2010 03:34:01 +0100 >> >> Welcome to the R-help@r-project.org mailing list! >> >> To post to this list, send your email to: >> >> r-help@r-project.org >> >> General information about the mailing list is at: >> >> https://stat.ethz.ch/mailman/listinfo/r-help >> >> If you ever want to unsubscribe or change your options (eg, switch to >> or from digest mode, change your password, etc.), visit your >> subscription page at: >> >> https://stat.ethz.ch/mailman/options/r-help/gy631223%40hotmail.com >> >> You can also make such adjustments via email by sending a message to: >> >> r-help-requ...@r-project.org >> >> with the word `help' in the subject or body (don't include the >> quotes), and you will get back a message with instructions. >> >> You must know your password to change your options (including changing >> the password, itself) or to unsubscribe. It is: >> >> 8711208752 >> >> Normally, Mailman will remind you of your r-project.org mailing list >> passwords once every month, although you can disable this if you >> prefer. This reminder will also include instructions on how to >> unsubscribe or change your account options. There is also a button on >> your options page that will email your current password to you. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org ______________________________________________ R-help@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.