The R Project SVN R

Rev

Rev 74448 | Rev 83140 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 74448 Rev 75536
Line 24... Line 24...
24
\description{
24
\description{
25
  Description of the class \code{"Date"} representing calendar dates.
25
  Description of the class \code{"Date"} representing calendar dates.
26
}
26
}
27
\usage{
27
\usage{
28
\method{summary}{Date}(object, digits = 12, \dots)
28
\method{summary}{Date}(object, digits = 12, \dots)
-
 
29
 
-
 
30
\method{print}{Date}(x, max = NULL, \dots)
29
% not sure if we should not rather _drop_ the 'recursive'!
31
% not sure if we should not rather _drop_ the 'recursive'!
30
%\method{c}{Date}(\dots, recursive = FALSE)
32
%\method{c}{Date}(\dots, recursive = FALSE)
31
}
33
}
32
\arguments{
34
\arguments{
33
  \item{object}{a \code{Date} object to be summarized.}
35
  \item{object, x}{a \code{Date} object to be summarized or printed.}
34
  \item{digits}{Number of significant digits for the computations.}
36
  \item{digits}{number of significant digits for the computations.}
-
 
37
  \item{max}{numeric or \code{NULL}, specifying the maximal number of
-
 
38
    entries to be printed.  By default, when \code{NULL},
-
 
39
    \code{\link{getOption}("max.print")} used.}
35
  \item{\dots}{Further arguments to be passed from or to other methods.}
40
  \item{\dots}{further arguments to be passed from or to other methods.}
36
  %% \item{\dots, recursive}{further arguments to be passed from or to
41
  %% \item{\dots, recursive}{further arguments to be passed from or to
37
  %%   other methods; \code{recursive} is not considered in \code{Date} method.}
42
  %%   other methods; \code{recursive} is not considered in \code{Date} method.}
38
}
43
}
39
\details{
44
\details{
40
  Dates are represented as the number of days since 1970-01-01, with
45
  Dates are represented as the number of days since 1970-01-01, with
Line 47... Line 52...
47
  enforced in the internal representation.  Fractional days will be
52
  enforced in the internal representation.  Fractional days will be
48
  ignored when printing.  It is possible to produce fractional days via
53
  ignored when printing.  It is possible to produce fractional days via
49
  the \code{mean} method or by adding or subtracting (see
54
  the \code{mean} method or by adding or subtracting (see
50
  \code{\link{Ops.Date}}).
55
  \code{\link{Ops.Date}}).
51
 
56
 
52
  The print methods respect \code{\link{options}("max.print")}.
57
  From the many methods, see \code{methods(class = "Date")}, a few are
-
 
58
  documented separately, see below.
53
}
59
}
54
\seealso{
60
\seealso{
55
  \code{\link{Sys.Date}} for the current date.
61
  \code{\link{Sys.Date}} for the current date.
56
 
62
 
57
  \code{\link{Ops.Date}} for operators on \code{"Date"} objects.
63
  \code{\link{weekdays}} for convenience extraction functions.
58
 
64
 
-
 
65
  Methods with extra arguments and documentation:
-
 
66
  \describe{
59
  \code{\link{format.Date}} for conversion to and from character strings.
67
    \item{\code{\link{Ops.Date}}}{for operators on \code{"Date"} objects.}
60
 
68
 
61
  \code{\link{axis.Date}} and
-
 
62
  \code{\link{hist.Date}} for plotting.
69
    \item{\code{\link{format.Date}}}{for conversion to and from character strings.}
63
 
70
 
64
  \code{\link{weekdays}} for convenience extraction functions.
-
 
65
 
-
 
66
  \code{\link{seq.Date}}, \code{\link{cut.Date}},
71
    \item{\code{\link{axis.Date}}}{and \code{\link{hist.Date}} for plotting.}
67
  \code{\link{round.Date}} for utility operations.
-
 
68
 
72
 
-
 
73
    \item{\code{\link{seq.Date}}}{, \code{\link{cut.Date}}, and
-
 
74
      \code{\link{round.Date}} for utility operations.}
-
 
75
  }
69
  \code{\link{DateTimeClasses}} for date-time classes.
76
  \code{\link{DateTimeClasses}} for date-time classes.
70
}
77
}
71
\examples{\donttest{
78
\examples{\donttest{
72
(today <- Sys.Date())
79
(today <- Sys.Date())
73
format(today, "\%d \%b \%Y")  # with month as a word
80
format(today, "\%d \%b \%Y")  # with month as a word
74
(tenweeks <- seq(today, length.out=10, by="1 week")) # next ten weeks
81
(tenweeks <- seq(today, length.out=10, by="1 week")) # next ten weeks
75
weekdays(today)
82
weekdays(today)
76
months(tenweeks)
83
months(tenweeks)
-
 
84
}% dont
77
(Dls <- as.Date(.leap.seconds))
85
(Dls <- as.Date(.leap.seconds))
78
 
86
 
79
##  length(<Date>) <- n   now works
87
##  length(<Date>) <- n   now works
80
ls <- Dls; length(ls) <- 12
88
ls <- Dls; length(ls) <- 12
81
l2 <- Dls; length(l2) <- 5 + length(Dls)
89
l2 <- Dls; length(l2) <- 5 + length(Dls)
Line 84... Line 92...
84
  identical(ls, Dls[seq_along(ls)])
92
  identical(ls, Dls[seq_along(ls)])
85
  identical(l2, Dls[seq_along(l2)])
93
  identical(l2, Dls[seq_along(l2)])
86
  ## has filled with NA's
94
  ## has filled with NA's
87
  is.na(l2[(length(Dls)+1):length(l2)])
95
  is.na(l2[(length(Dls)+1):length(l2)])
88
})
96
})
89
}}
97
}
90
\keyword{utilities}
98
\keyword{utilities}
91
\keyword{chron}
99
\keyword{chron}