[R] How to obtain a sequence of dates consisting of only weekdays

Yihui Xie xieyihui at gmail.com
Thu Sep 11 11:23:56 CEST 2008


Then you can use c() to add the indices of those weeks which are not
"complete", or use something like this

# from Tuesday to next Wedsday
> !(2:10 %% 7) %in% c(0,6)
[1]  TRUE  TRUE  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE

Yihui

On Thu, Sep 11, 2008 at 5:08 PM, Weiyang Lim <Weiyang.Lim at henderson.com> wrote:
> Hi,
>
> Thanks for the reply. I also thought of your method. But it will not be quite right if my starting day is not on a Monday. Then, it will include weekends? Hope to have flexibility in that the starting day can be any day of the week not just monday.
>
> wy
>


-- 
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



More information about the R-help mailing list