Skip to content

Commit

Permalink
#98 rlang::is_missing() fails with default
Browse files Browse the repository at this point in the history
  • Loading branch information
mdancho84 committed Nov 30, 2021
1 parent 725d0e9 commit 7285192
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion R/augment-tk_augment_differences.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ tk_augment_differences <- function(.data,
# Checks
column_expr <- enquo(.value)
if (rlang::quo_is_missing(column_expr)) stop(call. = FALSE, "tk_augment_differences(.value) is missing.")
if (rlang::is_missing(.lags)) stop(call. = FALSE, "tk_augment_differences(.lags) is missing.")
# if (rlang::is_missing(.lags)) stop(call. = FALSE, "tk_augment_differences(.lags) is missing.")
# if (rlang::is_missing(.differences)) stop(call. = FALSE, "tk_augment_differences(.differences) is missing.")
if (!any(.names == "auto")) {
if (length(.names) != length(.lags) * length(.differences)) {
Expand Down
11 changes: 6 additions & 5 deletions R/augment-tk_augment_fourier.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ NULL
#' @export
#' @rdname tk_augment_fourier
tk_augment_fourier <- function(.data,
.date_var,
.periods,
.K = 1,
.names = "auto") {
.date_var,
.periods,
.K = 1,
.names = "auto"
) {
# Checks
column_expr <- enquo(.date_var)
if (rlang::quo_is_missing(column_expr)) stop(call. = FALSE, "tk_augment_fourier(.date_var) is missing.")
if (rlang::is_missing(.periods)) stop(call. = FALSE, "tk_augment_fourier(.periods) is missing.")
if (rlang::is_missing(.K)) stop(call. = FALSE, "tk_augment_fourier(.K) is missing.")
# if (rlang::is_missing(.K)) stop(call. = FALSE, "tk_augment_fourier(.K) is missing.")
if (!any(.names == "auto")) {
if (length(.names) != length(.periods) * 2) {
rlang::abort(".names must be a vector of length ", length(.periods) * 2)
Expand Down
4 changes: 2 additions & 2 deletions R/augment-tk_augment_lags.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ tk_augment_lags <- function(.data,
column_expr <- enquo(.value)

if (rlang::quo_is_missing(column_expr)) stop(call. = FALSE, "tk_augment_lags(.value) is missing.")
if (rlang::is_missing(.lags)) stop(call. = FALSE, "tk_augment_lags(.lags) is missing.")
# if (rlang::is_missing(.lags)) stop(call. = FALSE, "tk_augment_lags(.lags) is missing.")

UseMethod("tk_augment_lags", .data)
}
Expand Down Expand Up @@ -165,7 +165,7 @@ tk_augment_leads <- function(.data,
column_expr <- enquo(.value)

if (rlang::quo_is_missing(column_expr)) stop(call. = FALSE, "tk_augment_leads(.value) is missing.")
if (rlang::is_missing(.lags)) stop(call. = FALSE, "tk_augment_leads(.lags) is missing.")
# if (rlang::is_missing(.lags)) stop(call. = FALSE, "tk_augment_leads(.lags) is missing.")

UseMethod("tk_augment_leads", .data)
}
Expand Down
4 changes: 2 additions & 2 deletions R/make-tk_make_timeseries.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ tk_make_timeseries <- function(start_date, end_date, by, length_out = NULL,

# Drop last value if length_out is character
# - This happens because the end_date is 1 period longer than the desired length out
if (!rlang::is_missing(length_out)) {
if (!is.null(length_out)) {
if (is.character(length_out)) {
seq <- seq[1:(length(seq)-1)]
}
Expand Down Expand Up @@ -324,7 +324,7 @@ tk_make_timeseries <- function(start_date, end_date, by, length_out = NULL,
# Handle character length_out
drop_end_1 <- FALSE
drop_begin_1 <- FALSE
if (!rlang::is_missing(length_out)) {
if (!is.null(length_out)) {
if (is.character(length_out)) {
if (!rlang::is_missing(start_date)) {
end_date <- start_date %+time% length_out
Expand Down

0 comments on commit 7285192

Please sign in to comment.