Description Usage Arguments Details Value Author(s) References See Also Examples
Convert date-time object into hour or half-hour units
1 |
x |
Date-time object in standard format: for example, "2004-12-23 08:27:00", "2004-12-23 08:27", "2004-12-23" |
mindt |
[required] Date-time object in standard format that will form the lower
boundary of the hour or half-hour time categories. |
maxdt |
[required] Date-time object in standard format that will form the upper
boundary of the hour or half-hour time categories. |
half.hour |
Set to TRUE for half-hour categories. |
This function (1) converts standard date-time objects into 1-hour or
1/2-hour categories, and (2) generates levels for range of values that
that the new 1-hour or 1/2-hour categories can take. These levels are
use for converting x into a factor and for providing names for labeling
the x-axis in plot. This function is used by epicurves.hours
.
$ct |
Date-time object that contains the number of seconds since the beginning
of 1970 as a numeric vector and produced by |
$sec |
seconds |
$min |
minutes |
$hour |
hours (0-23) |
$hour12 |
hours (1-12) |
$stratum |
number of hours or 1/2 hours since beginning of 1970 |
$stratum2 |
factor (categorical variable) with number of hours of 1/2 hours since
beginning of 1970 using |
$stratum3 |
factor (categorical variable) in standard date-time format indicating
number of hours or 1/2 hours since beginning of 1970 using
|
$cstratum |
levels for creating |
$cstratum2 |
levels for creating |
$csec |
seconds from |
$cmin |
minutes from |
$chour |
hours from |
$chour12 |
hours from |
$campm |
corresponding 'AM' or 'PM' for |
$campm2 |
corresponding 'am' or 'pm' for |
$cweekday |
day of the week for |
$cwkday |
abbreviated day of the week for |
$cmday |
day of the month for |
$cmonth |
month for |
$cmon |
abbreviated month for |
$cyear |
year for |
$half.hour |
FALSE (default) for 1-hour categories; TRUE for 1/2-hour categories |
Tomas Aragon, aragon@berkeley.edu, http://www.phdata.science
none
epitools: as.month
, epicurve.dates
as.Date
, strptime
,
DateTimeClasses
1 2 3 4 5 6 7 8 9 10 11 12 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.