search for: wday

Displaying 20 results from an estimated 139 matches for "wday".

Did you mean: way
2008 Dec 11
3
getting ISO week
...t(date.posix,"%Y")) M<-as.numeric(format(date.posix,"%m")) D<-as.numeric(format(date.posix,"%d")) } LY<- (Y%%4==0 & !(Y%%100==0))|(Y%%400==0) LY.prev<- ((Y-1)%%4==0 & !((Y-1)%%100==0))|((Y-1)%%400==0) date.yday<-date.posix$yday+1 jan1.wday<-strptime(paste(Y,"01-01",sep="-"),"%Y-%m-%d")$wday jan1.wday<-ifelse(jan1.wday==0,7,jan1.wday) date.wday<-date.posix$wday date.wday<-ifelse(date.wday==0,7,date.wday) ####If the date is in the beginning, or end of the year, ### does it fall into...
2010 May 19
0
A revised function for getting ISO week
...t(date.posix,"%Y")) M<-as.numeric(format(date.posix,"%m")) D<-as.numeric(format(date.posix,"%d")) } LY<- (Y%%4==0 & !(Y%%100==0))|(Y%%400==0) LY.prev<- ((Y-1)%%4==0 & !((Y-1)%%100==0))|((Y-1)%%400==0) date.yday<-date.posix$yday+1 jan1.wday<-strptime(paste(Y,"01-01",sep="-"),"%Y-%m-%d")$wday jan1.wday<-ifelse(jan1.wday==0,7,jan1.wday) date.wday<-date.posix$wday date.wday<-ifelse(date.wday==0,7,date.wday) ####If the date is in the beginning, or end of the year, ### does it fall into...
2013 Oct 04
2
Possible POSIXlt / wday glitch & bugs.r-project.org status
...roject.org PING rbugs.research.att.com (207.140.168.137): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 Request timeout for icmp_seq 3 Request timeout for icmp_seq 4 Request timeout for icmp_seq 5 Request timeout for icmp_seq 6 ``` 2. Is wday element of POSIXlt meant to be timezone invariant? You would expect the wday element to be invariant to the timezone of a date. That is, the same date/time instant of 5th October 2013 in both Australia/Sydney and UTC should be a Saturday (i.e. wday = 6). And indeed that is the case with 1 min past...
2007 Dec 17
4
wday not honored in cron trigger
Hey guys, I was playing with the cron trigger, and I noticed that wday is not honored. Looking at the code confirms this. Has anyone else seen this? Thanks Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20071217/44d3a8a6/attachment.html
2010 Mar 25
4
Creating dataframe of all possible variable combinations
Hello, I need to create a dataframe containing all possible combinations of three variables: SITE (101,102,103,104), WDAY (MON,TUE,WED,THR,FRI), and TOD (MORN, AFTN). There should be a total of 40 unique combinations in my dataframe. I used expand.grid() successfully(?) to create my dataframe, but then when I went to order it by SITE, the resultant dataframe only contained four rows, one for each site. There must be s...
2007 Oct 15
3
for loop if else conditional
date <- as.POSIXlt(Sys.time()) #present date for (i in 1:difftime(as.POSIXlt(Sys.Date()),"2007-10-01")) if (date$wday != 0 & date$wday != 6) {print(date);assign("date", (date-86400))} else (assign("date", (date-86400))) I am trying to print dates from present day to a day in the past, but omitting weekends. I am not doing something right, but can't figure out what. Help appreciated!...
2010 Oct 01
3
Converting a dataframe column from string to datetime
...[[1]] [1] "2010-02-05 20:00:01.43" [[2]] [1] "2010-02-05 20:00:02.274" [[3]] [1] "2010-02-05 20:00:02.274" [[4]] [1] "2010-02-05 20:00:06.34" However, when I do an unlist...I gets converted to something like this... sec min hour mday mon year wday yday isdst sec min hour mday mon year wday yday isdst sec 1.430 0.000 20.000 5.000 1.000 110.000 5.000 35.000 0.000 2.274 0.000 20.000 5.000 1.000 110.000 5.000 35.000 0.000 2.274 min hour mday mon year wday yday isdst...
2011 May 14
2
changing the day of the week in dates format
...rtx, 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...
2003 Aug 13
1
Problems with addition in big POSIX dates
Have you noticed any problems with big dates (>=1/1/2040) in R? Here is the bit of code that I'm having trouble with: > test.date <- strptime("1/1/2040",format="%m/%d/%Y") > > unlist(test.date) sec min hour mday mon year wday yday isdst 0 0 0 1 0 140 0 0 0 > > date.plus.one <- as.POSIXct(test.date) + 24*60*60 > date.plus.one.lt <- as.POSIXlt(date.plus.one) > > unlist(date.plus.one.lt) sec min hour mday mon year wday yday isdst 0 0 0...
2007 Jan 17
2
problem with unlist POSIX date at midnight
...c.period[16]) is not the solution.... begin=paste(dates[i]-1,"09:00:00") end=paste(dates[i],"08:00:00") acc.period=seq(as.POSIXct(begin),as.POSIXct(end),"hour") unlist(strptime(acc.period[16],format="%Y-%m-%d %H:%M:%S")) # sec min hour mday mon year wday yday isdst # NA NA NA NA NA NA NA NA -1 unlist(strptime(acc.period[17],format="%Y-%m-%d %H:%M:%S")) # sec min hour mday mon year wday yday isdst # 0 0 1 1 2 106 3 59 0 a="2006-03-01 00:00:00" unlist(strptime...
2008 Nov 11
1
Every other week recurring event
I have the code for computing a weekly event: (start_date..end_date).select{|d| d.wday == wday} but I am wondering if anyone has any ideas for using this to figure out a recurring event for every other week. Is it possible to somehow specify every other within the .select method? Any other implementation ideas? --~--~---------~--~----~------------~-------~--~----~ You received thi...
2007 Oct 15
1
String concatenation, File Path Handling to pass to download.file( ) [backslash in DOS paths]
...then 'else' should take over and decrement the date. I also have problem My crude solution is this (I am just 4-day old into learning/using R): #begin script date <- as.POSIXlt(Sys.time()) #present date for (i in 1:difftime(as.POSIXlt(Sys.Date()),"2007-10-01")) if (date$wday != 0 & date$wday != 6) #check whether weekday { datestr <- as.character(date, "%d%m%y") #make date character string ddmmyy url <- paste("http://www.bseindia.com/bhavcopy/eq",datestr,"_csv.zip",sep="") file <- paste("C:\\Pro...
2007 Oct 16
1
try / tryCatch for download.file( ) within a for loop when URL does not exist
...bout try / tryCatch but am having trouble understanding what/how it does. Thanks. #begin script date <- as.POSIXlt(as.Date("2007-10-15", "%Y-%m-%d")) for (i in 1:difftime(as.POSIXlt(as.Date("2007-10-15", "%Y-%m-%d")),"2007-10-01")) { if (date$wday != 0 & date$wday != 6) { datestr <- as.character(date, "%d%m%y") #make date character string ddmmyy url <- paste("http://www.bseindia.com/bhavcopy/eq",datestr,"_csv.zip",sep="") file <- paste("C:/",datestr,"_csv.zip",sep=&q...
2007 Dec 11
0
holidayNYSE missing some
...8959B3D65D449266DE8D3825E0821F7F47@nycmsg501.nikkoam.com>> > > Content-Type: text/plain; charset="us-ascii" > > > > This is deliberate behavior. If you check the code, the third-to-last > > line is as follows: > > ans = ans[!(as.POSIXlt(ans@Data)$wday == 0 | > > as.POSIXlt(ans@Data)$wday== 6)] > > > > > > You could make an alternate version of holidayNYSE that omits this line, > > if you like. > > > > -CN > > > > Charles Naylor > > Assistant Vice President > > Global Dynamic Asset...
2005 Oct 06
2
isdst
Can someone, please, explain the difference is results below (notice the isdst value) > unlist(as.POSIXlt('2005-7-1')) sec min hour mday mon year wday yday isdst 0 0 0 1 6 105 5 181 1 > unlist(as.POSIXlt(as.Date('2005-7-1'))) sec min hour mday mon year wday yday isdst 0 0 0 1 6 105 5 181 0
2002 Feb 11
2
Time Series ts() Objects
Hi, Is it possible to create a ts() object, whose data is daily based BUT measured only on working days? In other words, suppose I have a data set with 255 observations, measured from 29 June 1959 to 30 June 1960. How would I create such a data? I tried something like: ts(c(...), start(1959, 180)) but I'm not sure what to use for frequency. In other words I don't know how to
2008 Nov 21
5
Getting the number of years between two dates
Hey, I need to get the number of years (as a number) between two dates. Here is what I have as a helper. # Returns the number of years between now and the specified date. def years_ago(date) dateDifference = DateTime.now - date results =Date.day_fraction_to_time(dateDifference) return results[0] / 24 / 365; end I''m sure there is a better way to do this. What is it?
2007 Dec 11
3
Wrong length of POSIXt vectors (PR#10507)
...15L, 16L, 18L, 18L, NA, 20L, 22L, 22L ), hour = c(12L, 12L, 12L, 12L, 12L, 12L, 12L, NA, 12L, 12L, 12L), mday = c(13L, 13L, 13L, 13L, 13L, 13L, 13L, NA, 13L, 13L, 13L), mon = c(5L, 5L, 5L, 5L, 5L, 5L, 5L, NA, 5L, 5L, 5L), year = c(105L, 105L, 105L, 105L, 105L, 105L, 105L, NA, 105L, 105L, 105L), wday = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L), yday = c(163L, 163L, 163L, 163L, 163L, 163L, 163L, NA, 163L, 163L, 163L), isdst = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, -1L, 1L, 1L, 1L)), .Names = c("sec", "min", "hour", "mday", "mon", "year",...
2010 Dec 27
1
Can't merge on datetime?
...7L, 18L, 19L, 22L, 23L, 24L, 25L, 26L, 29L), mon = c(10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L), year = c(110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L), wday = c(1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L), yday = c(304L, 305L, 306L, 307L, 308L, 311L, 312L, 313L, 314L, 315L, 318L, 319L, 320L, 321L, 322L, 325L, 326L, 327L, 328L, 329L, 332L), isdst = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,...
2006 Apr 10
3
timeAlign
I use POSIXct for datetimes. Is thee a timeAlign function that I can use where : align by year direction -1 ==> start of this year direction 1 ==> start of next year align by week direction -1 ==> date on last sunday direction 1 ==> date on next sunday align by day direction -1 ==> time at past midnight direction 1 ==> time at this comming