From 2ca01e2d8da73e7d922a9186964faf29d7a57bc6 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Sun, 1 Jul 2018 22:23:34 +0200 Subject: [PATCH] remove rlang dependency --- DESCRIPTION | 1 - R/freq.R | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b97bf3be..419e6fc0 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,7 +36,6 @@ Imports: xml2 (>= 1.0.0), knitr (>= 1.0.0), readr, - rlang (>= 0.2.0), rvest (>= 0.3.2), tibble Suggests: diff --git a/R/freq.R b/R/freq.R index 0edcdadf..6fe10971 100755 --- a/R/freq.R +++ b/R/freq.R @@ -55,7 +55,6 @@ #' @importFrom dplyr %>% select pull n_distinct group_by arrange desc mutate summarise #' @importFrom utils browseVignettes #' @importFrom tibble tibble -#' @importFrom rlang ensyms #' @keywords summary summarise frequency freq #' @rdname freq #' @name freq @@ -115,11 +114,14 @@ frequency_tbl <- function(x, if (x.name == ".") { x.name <- NULL } - dots <- rlang::ensyms(...) + dots <- base::eval(base::substitute(base::alist(...))) ndots <- length(dots) if (ndots > 0 & ndots < 10) { cols <- as.character(dots) + if (!all(cols %in% colnames(x))) { + stop("one or more columns not found: `", paste(cols, collapse = "`, `"), '`', call. = FALSE) + } x <- x[, cols] } else if (ndots >= 10) { stop('A maximum of 9 columns can be analysed at the same time.', call. = FALSE)