-1

for example in a date in thee form 07/03/2015 how can I add 30 trading days??

as.Date("07/03/2015", format="%d/%m/%Y") + 30 [1] "2015-04-06"`

this take into account also Sundays and Saturdays how can I add only the trading days? thanks

1 Answers1

0

Is this what you are looking for?

Create data:

library(chron)
dates <- seq.dates("07/03/2015", by = "day", length = 30)

Generate weekdays:

dates <- weekdays(as.Date(dates))

Extract the days of the week:

remove <- c('Saturday', 'Sunday')
dates [! dates %in% remove]
user113156
  • 6,761
  • 5
  • 35
  • 81