search for: getweek

Displaying 3 results from an estimated 3 matches for "getweek".

2008 Dec 11
3
getting ISO week
...g the ISO weeks of a Date object? I couldn't find one, and so wrote my own function to do it, but would appreciate a pointer to the "default" way. If a function is not yet implemented, could the code below be of interest to submit to CRAN? Best Regards, Gustaf -------------------- getweek<-function(Y,M=NULL,D=NULL){ if(!class(Y)[1]%in%c("Date","POSIXt")) { date.posix<-strptime(paste(c(Y,M,D),collapse="-"),"%Y-%m-%d") } if(class(Y)[1]%in%c("POSIXt","Date")){ date.posix<-as.POSIXlt(Y) Y<-as.numeric(format...
2010 May 19
0
A revised function for getting ISO week
...hought I'd repost the corrected version. Hopefully this will come in handy for someone searching the mailing list archives in the future. Best Regards, Gustaf ############# ## Inputs a date object, posix object, or 3 numbers and gives back the iso week. ## By Gustaf Rydevik, revised 2010 getweek<-function(Y,M=NULL,D=NULL){ if(!class(Y)[1]%in%c("Date","POSIXt")) { date.posix<-strptime(paste(Y,M,D,sep="-"),"%Y-%m-%d") } if(class(Y)[1]%in%c("POSIXt","Date")){ date.posix<-as.POSIXlt(Y) Y<-as.numeric(format(date.po...
2010 Nov 07
2
stupid R tricks
Hi all, Just thought I'd post this (maybe) helpful tool I wrote. For people like me who are bad at keeping a clean environment, it's a time-saver. #simple command to get only one type of object in current environment lstype<-function(type='closure'){ inlist<-ls(.GlobalEnv) if (type=='function') type <-'closure'