Functions and tips for use in the R statistical environment.
is.leapyear=function(year){ #http://en.wikipedia.org/wiki/Leap_year return(((year %% 4 == 0) & (year %% 100 != 0)) | (year %% 400 == 0))}
Alternatively,format(as.POSIXct(paste(year,"-03-01",sep=""))-1,"%d")=="29"
Post a Comment
1 comment:
Alternatively,
format(as.POSIXct(paste(year,"-03-01",sep=""))-1,"%d")=="29"
Post a Comment