as.week(x, format = "%Y-%m-%d",
min.date, max.date, before = 7, after = 7,
origin = as.Date("1970-01-01"), sunday = TRUE)
x
; default is of form "2004-08-10"
x
as specified by the before
option
x
as specified by the after
option
min.date
is not specified, then these number of days are
subtracted from the minimum date in x
for plotting minimum
calendar date for epidemic curve
max.date
is not specified, then these number of days are
added to the maximum date in x
for plotting maximum calendar
date for epidemic curve
$week
value
$week
value
converted to a factor with levels determined by the Julian dates
($cstratum
) used to plot the epidemic curve
$week
value converted to standard
calendar dates
$cweek
value used
for plotting the x-axis of an epidemic curve
$cweek
value used for plotting the x-axis of an epidemic curve
as.week
function generates weeks numbered
from 1 to 53. The week before week 1 takes on the value (52 or 53)
from the last week of the previous year. The as.week
functions
facilitates working with multiple years and generating epidemic curves.as.month
, epicurve.dates
as.Date
, strptime
,
DateTimeClasses
dates <- c("1/1/04", "1/2/04", "1/3/04", "1/4/04", "1/5/04",
"1/6/04", "1/7/04", "1/8/04", "1/9/04", "1/10/04", NA, "1/12/04",
"1/14/04", "3/5/04", "5/5/04", "7/6/04", "8/18/04", "12/13/05",
"1/5/05", "4/6/05", "7/23/05", "10/3/05")
aw <- as.week(dates, format = "%m/%d/%y")
aw
aw2 <- as.week(dates, format = "%m/%d/%y", sunday= FALSE)
aw2
aw3 <- as.week(dates, format = "%m/%d/%y", min.date="2003-01-01")
aw3
Run the code above in your browser using DataLab