Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/accessors-minute.r
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ NULL

#' Get/set minutes component of a date-time
#'
#' Date-time must be a POSIXct, POSIXlt, Date, Period, chron, yearmon, yearqtr, zoo,
#' Date-time must be a POSIXct, POSIXlt, Date, Period, chron, yearmon, yearqtr, zoo,
#' zooreg, timeDate, xts, its, ti, jul, timeSeries, and fts objects.
#'
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/accessors-month.r
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ days_in_month <- function(x) {
n_days
}

## fixme: integrate with above, this oen is needed internally
## fixme: integrate with above, this one is needed internally
.days_in_month <- function(m, y) {
n_days <- N_DAYS_IN_MONTHS[m]
n_days[m == 2L & leap_year(y)] <- 29L
Expand Down
6 changes: 3 additions & 3 deletions R/accessors-quarter.r
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ NULL

#' Get the fiscal quarter and semester of a date-time
#'
#' Quarters divide the year into fourths. Semesters divide the year into halfs.
#' Quarters divide the year into fourths. Semesters divide the year into halves.
#'
#' @param x a date-time object of class POSIXct, POSIXlt, Date, chron, yearmon, yearqtr,
#' zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, fts or anything else that can
#' be converted with as.POSIXlt
#' @param type the format to be returned for the quarter. Can be one one of "quarter" -
#' @param type the format to be returned for the quarter. Can be one of "quarter" -
#' return numeric quarter (default), "year.quarter" return the ending year and quarter
#' as a number of the form year.quarter, "date_first" or "date_last" - return the date
#' at the quarter's start or end, "year_start/end" - return a full description of the
Expand Down Expand Up @@ -74,7 +74,7 @@ quarter <- function(x, type = "quarter", fiscal_start = 1, with_year = identical
add_with_rollback(quarter_starting_dates, months(3)) - days(1)
}
},
stop("Unsuported type ", type)
stop("Unsupported type ", type)
)
}

Expand Down
2 changes: 1 addition & 1 deletion R/accessors-second.r
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ NULL

#' Get/set seconds component of a date-time
#'
#' Date-time must be a POSIXct, POSIXlt, Date, Period, chron, yearmon, yearqtr, zoo,
#' Date-time must be a POSIXct, POSIXlt, Date, Period, chron, yearmon, yearqtr, zoo,
#' zooreg, timeDate, xts, its, ti, jul, timeSeries, and fts objects.
#'
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/accessors-tz.r
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' For backward compatibility, the time zone of a date, `NA`, or
#' character vector is `"UTC"`.
#' @seealso See [DateTimeClasses] for a description of the underlying
#' `tzone` attribute..
#' `tzone` attribute.
#' @keywords utilities manip chron methods
#' @examples
#' x <- y <- ymd_hms("2012-03-26 10:10:00", tz = "UTC")
Expand Down
14 changes: 7 additions & 7 deletions R/coercion.r
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ reclass_timespan <- function(new, orig) standardGeneric("reclass_timespan")
#' @export
setGeneric("reclass_timespan",
useAsDefault = function(new, orig) {
stop(sprintf("reclass_timespan is not defined for class '%s'", class(x)))
stop(sprintf("reclass_timespan is not defined for class '%s'", class(orig)))
}
)

Expand Down Expand Up @@ -390,10 +390,10 @@ setMethod("as.period", signature(x = "difftime"), function(x, unit = NULL, ...)
setMethod("as.period", signature(x = "Interval"), function(x, unit = NULL, ...) {
## fixme: document this in the manual

## SEMANTICS: for postitive intervals all units of the period will be
## positive, and the oposite for negatve intervals.
## SEMANTICS: for positive intervals all units of the period will be
## positive, and the opposite for negative intervals.

## Periods are not symetric in the sense that as.period(int) might not be the
## Periods are not symmetric in the sense that as.period(int) might not be the
## same as -as.period(int_flip(int)). See
## https://github.com/tidyverse/lubridate/issues/285 for motivation.

Expand Down Expand Up @@ -423,7 +423,7 @@ setMethod("as.period", signature(x = "Interval"), function(x, unit = NULL, ...)
pers[negs] <- -pers[negs]
pers
},
stop("Unsuported unit ", unit)
stop("Unsupported unit ", unit)
)
})

Expand Down Expand Up @@ -493,7 +493,7 @@ setMethod("as.period", signature(x = "Interval"), function(x, unit = NULL, ...)
per$month[ndays] <- per$month[ndays] - add_months
}

## substract only after the day computation to capture intervals like:
## subtract only after the day computation to capture intervals like:
## as.period(interval(ymd_hms("1985-12-31 5:0:0"), ymd_hms("1986-02-01 3:0:0")))
per$day[nhous] <- per$day[nhous] - 1
per$day[negs] <- -per$day[negs]
Expand Down Expand Up @@ -561,7 +561,7 @@ setMethod(
N <- .units_within_seconds(period_to_seconds(x), unit)
do.call("new", c("Period", N))
},
stop("Unsuported unit ", unit)
stop("Unsupported unit ", unit)
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/durations.r
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ average_durations <- c(
stop(sprintf("First argument to `duration()` constructor must be character or numeric. Supplied object of class '%s'", class(num)))
}

## qucik check for common wrongdoings: #462
## quick check for common wrongdoings: #462
if (inherits(num, c("Interval", "Period"))) {
stop("Interval or Period objects cannot be used as input to `duration()` constructor. Use `as.duration()` instead.", call. = FALSE)
}
Expand Down
4 changes: 2 additions & 2 deletions R/guess.r
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ guess_formats <- function(x, orders, locale = Sys.getlocale("LC_TIME"),
orders <- c(sub("r", "HOp", orders[wr], fixed = T), orders)
}

## We split into characterst first and then paste together formats that start
## We split into characters first and then paste together formats that start
## with O.
osplits <- strsplit(orders, "", fixed = TRUE)
osplits <- lapply(
Expand Down Expand Up @@ -487,7 +487,7 @@ guess_formats <- function(x, orders, locale = Sys.getlocale("LC_TIME"),
num_flex["m"] <- sprintf("((?<m>1[0-2]|0?[1-9](?!\\d))|(%s))", gsub("_[bB]", "\\1_m", alpha[["b"]]))
num_exact["m"] <- sprintf("((?<m_e>1[0-2]|0[1-9])|(%s))", gsub("_[bB]", "\\1_m_e", alpha[["b"]]))

## canoot be in num above because gsub("+", "*") messes it up
## cannot be in num above because gsub("+", "*") messes it up
num_flex["OS"] <- "(?<OS_f>[0-5]\\d\\.\\d+)"
num_exact["OS"] <- "(?<OS_e>[0-5]\\d\\.\\d+)"
num_flex["z"] <- sprintf("(%s|%s|%s|%s)", alpha_flex[["Ou"]], num_flex[["Oz"]], num_flex[["OO"]], num_flex[["Oo"]])
Expand Down
2 changes: 1 addition & 1 deletion R/instants.r
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ origin <- structure(0, class = c("POSIXct", "POSIXt"), tzone = "UTC")
.rep_maybe <- function(x, N) {
if (N > 1 && length(x) > 1 && length(x) != N) {
out <- rep_len(x, N)
## repl_len doesn't preserve attributes
## rep_len doesn't preserve attributes
if (is.POSIXct(x)) {
attributes(out) <- attributes(x)
}
Expand Down
2 changes: 1 addition & 1 deletion R/intervals.r
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ check_interval <- function(object) {
.units_within_seconds(secs %% 86400, "hour"),
list(day = secs %/% 86400)
),
stop("Unsuported unit ", unit)
stop("Unsupported unit ", unit)
)
}

Expand Down
6 changes: 3 additions & 3 deletions R/parse.r
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ hms <- function(..., quiet = FALSE, roll = FALSE) {
##'
##' \item{`r` (*)}{Matches `Ip` and `H` orders.}
##'
##' \item{`R` (*)}{Matches `HM` and`IMp` orders.}
##' \item{`R` (*)}{Matches `HM` and `IMp` orders.}
##'
##' \item{`T` (*)}{Matches `IMSp`, `HMS`, and `HMOS` orders.}
##' }
Expand Down Expand Up @@ -878,7 +878,7 @@ fast_strptime <- function(x, format, tz = "UTC", lt = TRUE, cutoff_2000 = 68L) {
## Expand format strings to also include truncated formats
## Get locations of letters as vector
## Choose the number at the n - truncated place in the vector
## return the substring created by 1 to tat number.
## return the substring created by 1 to that number.
.add_truncated <- function(orders, truncated) {
out <- orders

Expand Down Expand Up @@ -976,7 +976,7 @@ as_POSIXct <- function(x, tz = tz(x)) {
if (is.character(x)) {
.parse_iso_dt(x, tz = tz)
} else if (is.Date(x)) {
## as.POSIXct.Date assues UTC in computation but returns POSIXct with system TZ
## as.POSIXct.Date assumes UTC in computation but returns POSIXct with system TZ
## same as as_datetime Date method
.POSIXct(as.numeric(x) * 86400, tz = "UTC")
} else if (!is.POSIXct(x)) {
Expand Down
4 changes: 2 additions & 2 deletions R/periods.r
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ parse_period <- function(x) {
stop(sprintf("First argument to `period()` constructor must be character or numeric. Supplied object of class '%s'", class(num)))
}

## qucik check for common wrongdoings: #462
## quick check for common wrongdoings: #462
if (inherits(num, c("Interval", "Duration"))) {
stop("Interval or Durations objects cannot be used as input to 'period()' constructor. Plese use 'as.period()'.")
stop("Interval or Durations objects cannot be used as input to 'period()' constructor. Please use 'as.period()'.")
}

stop_incompatible_sizes(num, units)
Expand Down
2 changes: 1 addition & 1 deletion R/round.r
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ check_round_endpoints <- function(unit) {
stop("Zero length `unit` argument", call. = FALSE)
}
if (anyNA(unit)) {
stop("NAs in `unit` argument`", call. = FALSE)
stop("NAs in `unit` argument", call. = FALSE)
}
}

Expand Down
2 changes: 1 addition & 1 deletion R/timespans.r
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ NULL
#'
#'
#' @param x a duration, period, difftime or interval
#' @param unit a character string that specifies with time units to use
#' @param unit a character string that specifies which time units to use
#' @return the length of the interval in the specified unit. A negative number
#' connotes a negative interval or duration
#'
Expand Down
2 changes: 1 addition & 1 deletion R/tzdir.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tzdir_get <- function() {
Sys.getenv("TZDIR")
}

## adapted from Syz.timezone and OlsonNames function
## adapted from Sys.timezone and OlsonNames function
tzdir_find <- function() {
tzdirs <- c()

Expand Down
2 changes: 1 addition & 1 deletion R/util.r
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ parse_period_unit <- function(unit) {
if (length(wp) > 1) {
## Fractional units are actually supported but only when it leads to one
## final unit.
stop("Cannot't parse heterogenuous or fractional units larger than one minute.")
stop("Cannot parse heterogeneous or fractional units larger than one minute.")
}

list(n = p[wp], unit = period_units[wp])
Expand Down
Loading