Description Usage Arguments Details Value Author(s) References See Also Examples
Convert character vector of dates into multiple legible formats.
1 2 |
x |
character vector of dates to be converted |
format |
format of character vector of dates |
cal.dates |
Calendar dates that contains |
before |
defines lower limit of |
after |
defines upper limit of |
sunday |
first day of the week is either Sunday (default) or Monday |
Dates can come in many formats (e.g., November 12, 2001, 12Nov01, 11/12/2001, 11/12/01, 2001-11-12) and need to be converted into other formats for data analysis, graphical displays, generating reports, etc.
There is tremendous flexibility in converting any character vector
with sufficient information to be converted into a unique date. For
complete options for the format
option see
strptime
.
dates |
dates wtih date-time class |
julian |
number of days since 1970-01-01 |
mday |
day of the month: 1-31 |
mon |
month of the year: 0-11 |
month |
month: January, February, March, ... |
month2 |
month: Jan, Feb, Mar, ... |
firstday |
first day of the week: Sunday or Monday |
week |
week of the year: 0-53 |
year |
year: YYYY |
yr |
year: YY |
wday |
day of the week: 0-6 |
weekday |
weekday: Monday, Tuesday, Wednesday, ... |
wkday |
weekday: Mon, Tue, Wed, ... |
yday |
day of the year: 0-365 |
quarter |
quarter of the year: Q1, Q2, Q3, Q4 |
cdates |
Calendar dates that contains |
cjulian |
Julian calendar dates |
Tomas Aragon, aragon@berkeley.edu, http://www.phdata.science
none
DateTimeClasses
to learn about date-time classes
format.Date
to convert character vector of dates into
calendar dates with date-time class (done by epidate
)
strptime
to convert date-time character strings
into a date-time class
1 2 3 4 5 6 7 8 9 10 | #x <- c("12/1/03", "11/2/03", NA, "1/7/04", "1/14/04", "8/18/04")
#epidate(x, format = "%m/%d/%y")
#epidate(x, format = "%m/%d/%y", TRUE)
#
###convert vector of disease weeks into vector of mid-week dates
#dwk <- sample(0:53, 100, replace = TRUE)
#wk2date <- paste(dwk, "/", "Wed", sep="")
#wk2date[1:10]
#wk2date2 <- epidate(wk2date, format = "%U/%a")
#wk2date2$dates[1:20]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.