timeDate
OptionsProvides the means to set or view global options for working with
timeDate
objects and classes.
timeDateOptions(...)
a list, even if the list is of length 1.
If no arguments are given, timeDateOptions
returns
a list of current values for all options.
If a character vector is given as the only argument,
timeDateOptions
returns a list of current values for the options
named in the character vector.
If an object of mode "list"
is given as the only argument,
its components become the values for options with the corresponding names.
timeDateOptions
returns a list of the option values
before they were modified.
Usually, the list given as an argument is the return value
of a previous call to timeDateOptions
.
If arguments are given in name=value
form,
the values of the specified options are changed and timeDateOptions
returns a list of the option values before they were modified.
you can give a list or vector of character strings as the only
argument, or you can give any number of arguments in the name=value
form. Optionally, you can give no arguments.
See the Value and Side Effects sections for explanation.
a small number specifying the time series comparison tolerance.
This is used throughout the time series functions for frequency comparisons.
Frequencies are considered equal if they differ in absolute value
by less than ts.eps
.
a number specifying the tolerance for converting numeric vectors to numeric sequences.
If a numeric vector is an arithmetic sequence to within sequence.tol
, it can
be converted to a sequence.
a character string specifying the format for reading timeDate
objects
from character strings using the as
and timeDate
functions.
The default value is
"%m[/][.]%d[/][,]%y [%H[:%M[:%S[.%N]]][%p][[(]%3Z[)]]]"
,
which reads a wide variety of date strings.
To use the European day/month/year format, set this to
"%d[/][.]%m[/][,]%y [%H[:%M[:%S[.%N]]][%p][[(]%3Z[)]]]"
.
The elements of this format string are described in the
documentation for the timeDate
class
(class.timeDate
).
a character string specifying the format for printing timeDate
objects
to character strings.
The default value is "%02m/%02d/%04Y %02H:%02M:%02S.%03N"
.
To use the European day/month/year format, set this to
"%02d/%02m/%04Y %02H:%02M:%02S.%03N"
.
The elements of this format string are described in the
documentation for the timeDate
class
(class.timeDate
).
a character string specifying the format for printing
timeDate
objects when the
time.zone
option is set to GMT
and the time of every element of the timeDate
object is midnight.
See timeDate
for more information.
a 12-element character vector giving the names of the months.
a 12-element character vector giving the abbreviations for the names of the months.
a 7-element character vector giving the names of the days of the week, starting with Sunday.
a 7-element character vector giving the abbreviations for the names of the days of the week, starting with Sunday.
an integer indicating the first year of a 100-year span. This value is used to interpret and print two-digit years.
For example, if time.century=1950
, the year 50 is interpreted as 1950 and the year 49 is interpreted as 2049.
If time.century=1900
, the year 0 means 1900 and the year 99 means 1999.
a 2-element character vector giving strings for printing "AM" and "PM" in time objects.
a character string specifying the default time zone when none is given in a time object.
a character string specifying the format for reading timeSpan
objects from character strings using the as
and timeSpan
functions.
a character string specifying the format for printing timeSpan
objects to character strings.
The default values for some of the common options listed above are as
follows. Options that have never been set have the value NULL
sequence.tol=1e-6
time.am.pm=c("AM", "PM")
time.century=1930
time.in.format="[%m[/][.]%d[/][,]%y] [%H[:%M[:%S[.%N]]][%p][[(]%3Z[)]]]"
time.out.format="%02m/%02d/%Y %02H:%02M:%02S.%03N"
time.day.abb=c("Sun", "Mon", ..., "Sat")
time.day.name=c("Sunday", "Monday", ..., "Saturday")
time.month.abb=c("Jan", "Feb", ..., "Dec")
time.month.name=c("January", "February", ..., "December")
time.zone="GMT"
tspan.in.format=paste("[%yy[ear[s]][,]] [%dd[ay[s]][,]]",
"[%Hh[our[s]][,]] [%Mm[in[ute][s]][,]] [%Ss[ec[ond][s]][,]]",
"[%NM[s][S]]")
tspan.out.format="%dd %Hh %Mm %Ss %NMS",
ts.eps=1e-5
If timeDateOptions
is called with either a list as the single argument
or with one or more arguments in name=value
form,
the options specified are changed or created.
The options are stored in a list in a local environment
within the splusTimeDate
package.
Any modifications to the options disappear when the current session ends.
The next session will start with the default value of the options.
To see all the timeDate
options and their current values,
call timeDateOptions
with no arguments i.e. timeDateOptions()
To set timeDateOptions
temporarily in a function,
call timeDateOptions
as you normally would from the command line.
To ensure that your function finishes cleanly
and does not produce any side effects,
use on.exit
with the return value from
your call to timeDateOptions
.)
timeDateOptions(time.zone="PST")
Run the code above in your browser using DataLab