Re: [R] Extracting future and past workday dates

2010-08-06 Thread Sergey Goriatchev
Henrique, that is what I need!
Big thanks!

Regards,
Sergey

On Thu, Aug 5, 2010 at 14:56, Henrique Dallazuanna  wrote:
> n <- 3
> w <- as.numeric(format(Sys.Date(), '%w'))
> fut <- c(Sys.Date() - 0:(n + ifelse(w - n > 6, (w - n) - 6, 0)),
>  Sys.Date() + 1:(n + 1 + ifelse(w + n > 6, (w + n) - 6, 0)))
> sort(fut[!format(fut, '%w') %in% c(6, 0)])



-- 
Kniven skärpes bara mot stenen.

__
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.


Re: [R] Extracting future and past workday dates

2010-08-05 Thread Henrique Dallazuanna
Try this:

n <- 3
w <- as.numeric(format(Sys.Date(), '%w'))
fut <- c(Sys.Date() - 0:(n + ifelse(w - n > 6, (w - n) - 6, 0)),
 Sys.Date() + 1:(n + 1 + ifelse(w + n > 6, (w + n) - 6, 0)))
sort(fut[!format(fut, '%w') %in% c(6, 0)])



On Thu, Aug 5, 2010 at 9:09 AM, Sergey Goriatchev  wrote:

> Hi, Henrique
>
> Thank you for trying, but that is not what I want. You get WEEKdays, I
> need WORKdays, and preferably sorted in order from future to the past.
>
> Best,
> Sergey
>
> On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna 
> wrote:
> > Try this:
> >
> > c(Sys.Date() + 0:3, Sys.Date() - 0:3)
> >
> > or
> >
> > 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date()
> >
> > On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev 
> wrote:
> >>
> >> Hello everyone
> >>
> >> I need to extract a vector of (t-3) to (t+3) dates, only working days.
> >> How can I do that?
> >>
> >> For today I need a vector:
> >> 10.08.210
> >> 09.08.2010
> >> 06.08.2010
> >> 05.08.2010
> >> 04.08.2010
> >> 03.08.2010
> >> 02.08.2010
> >>
> >> Regards,
> >> Sergey
> >>
> >> --
> >> Kniven skärpes bara mot stenen.
> >>
> >> __
> >> 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.
> >
> >
> >
> > --
> > Henrique Dallazuanna
> > Curitiba-Paraná-Brasil
> > 25° 25' 40" S 49° 16' 22" O
> >
>
>
>
> --
> Kniven skärpes bara mot stenen.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

[[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.


Re: [R] Extracting future and past workday dates

2010-08-05 Thread Sergey Goriatchev
Thank you David, will check it out, as I use chron and zoo!

Regards,
Sergey

On Thu, Aug 5, 2010 at 14:29, David Winsemius  wrote:
>
> On Aug 5, 2010, at 8:09 AM, Sergey Goriatchev wrote:
>
>> Hi, Henrique
>>
>> Thank you for trying, but that is not what I want. You get WEEKdays, I
>> need WORKdays, and preferably sorted in order from future to the past.
>
> Perhaps you would be pleased to know that there is an is.holiday function in
> chron:
>
> http://finzi.psych.upenn.edu/R/library/chron/html/is.holiday.html
>
> --
> David.
>
>>
>> Best,
>> Sergey
>>
>> On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna 
>> wrote:
>>>
>>> Try this:
>>>
>>> c(Sys.Date() + 0:3, Sys.Date() - 0:3)
>>>
>>> or
>>>
>>> 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date()
>>>
>>> On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev 
>>> wrote:

 Hello everyone

 I need to extract a vector of (t-3) to (t+3) dates, only working days.
 How can I do that?

 For today I need a vector:
 10.08.210
 09.08.2010
 06.08.2010
 05.08.2010
 04.08.2010
 03.08.2010
 02.08.2010

 Regards,
 Sergey

 --
 Kniven skärpes bara mot stenen.

 __
 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.
>>>
>>>
>>>
>>> --
>>> Henrique Dallazuanna
>>> Curitiba-Paraná-Brasil
>>> 25° 25' 40" S 49° 16' 22" O
>>>
>>
>>
>>
>> --
>> Kniven skärpes bara mot stenen.
>>
>> __
>> 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.
>
> David Winsemius, MD
> West Hartford, CT
>
>



-- 
Kniven skärpes bara mot stenen.

__
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.


Re: [R] Extracting future and past workday dates

2010-08-05 Thread David Winsemius


On Aug 5, 2010, at 8:09 AM, Sergey Goriatchev wrote:


Hi, Henrique

Thank you for trying, but that is not what I want. You get WEEKdays, I
need WORKdays, and preferably sorted in order from future to the past.


Perhaps you would be pleased to know that there is an is.holiday  
function in chron:


http://finzi.psych.upenn.edu/R/library/chron/html/is.holiday.html

--
David.



Best,
Sergey

On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna  
 wrote:

Try this:

c(Sys.Date() + 0:3, Sys.Date() - 0:3)

or

0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date()

On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev  
 wrote:


Hello everyone

I need to extract a vector of (t-3) to (t+3) dates, only working  
days.

How can I do that?

For today I need a vector:
10.08.210
09.08.2010
06.08.2010
05.08.2010
04.08.2010
03.08.2010
02.08.2010

Regards,
Sergey

--
Kniven skärpes bara mot stenen.

__
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.




--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O





--
Kniven skärpes bara mot stenen.

__
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.


David Winsemius, MD
West Hartford, CT

__
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.


Re: [R] Extracting future and past workday dates

2010-08-05 Thread Sergey Goriatchev
Hi, Henrique

Thank you for trying, but that is not what I want. You get WEEKdays, I
need WORKdays, and preferably sorted in order from future to the past.

Best,
Sergey

On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna  wrote:
> Try this:
>
> c(Sys.Date() + 0:3, Sys.Date() - 0:3)
>
> or
>
> 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date()
>
> On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev  wrote:
>>
>> Hello everyone
>>
>> I need to extract a vector of (t-3) to (t+3) dates, only working days.
>> How can I do that?
>>
>> For today I need a vector:
>> 10.08.210
>> 09.08.2010
>> 06.08.2010
>> 05.08.2010
>> 04.08.2010
>> 03.08.2010
>> 02.08.2010
>>
>> Regards,
>> Sergey
>>
>> --
>> Kniven skärpes bara mot stenen.
>>
>> __
>> 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.
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>



-- 
Kniven skärpes bara mot stenen.

__
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.


Re: [R] Extracting future and past workday dates

2010-08-05 Thread Henrique Dallazuanna
Try this:

c(Sys.Date() + 0:3, Sys.Date() - 0:3)

or

0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date()

On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev  wrote:

> Hello everyone
>
> I need to extract a vector of (t-3) to (t+3) dates, only working days.
> How can I do that?
>
> For today I need a vector:
> 10.08.210
> 09.08.2010
> 06.08.2010
> 05.08.2010
> 04.08.2010
> 03.08.2010
> 02.08.2010
>
> Regards,
> Sergey
>
> --
> Kniven skärpes bara mot stenen.
>
> __
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

[[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.