Dear all,

I have a question related to the POSIXlt function in R.

I have a set of dates and times, for exmaple:

startx <- as.POSIXct("2011-01-01 00:00:00")
finx <- as.POSIXct("2011-12-31 00:00:00")

daysx<- seq(startx, finx, by="24 hours")

I
 want to change the dates of all the days falling on a Saturday to the 
next working day (i.e. Monday). So I convert dates to POSIXlt

mydaysx <- as.POSIXlt(daysx)

Then I change select all the Saturday's and move them on to Monday

select <- mydaysx$wday==6
mydaysx$mday[select] <- mydaysx$mday[select] + 2

However,
 although all the new dates (i.e. mydaysx) are actual days of the year -
 the $wday have not been updated and the $mdays have not all been 
corrected (i.e. those falling into the next month). So if I do

select <- mydaysx$wday==6

I still get the same set of days as before.

Is there a way to do this?

Thanks,

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

Reply via email to