Skip to content

Commit

Permalink
refactor: lint 1 script
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Oct 12, 2023
1 parent 90e7726 commit d347f9f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/spq_select.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#' Select (and create) particular variables
#' @inheritParams spq_arrange
#' @param .spq_duplicate How to handle duplicates: keep them (`NULL`), eliminate (`distinct`)
#' @param .spq_duplicate How to handle duplicates: keep them (`NULL`),
#' eliminate (`distinct`)
#' or reduce them (`reduced`, advanced usage).
#' @return A query object
#' @export
#' @examples
#'
#' query = spq_init()
#' spq_select(query, count = n (human), eyecolor_label, haircolor_label)
spq_select = function(.query = NULL, ..., .spq_duplicate = NULL){
spq_select = function(.query = NULL, ..., .spq_duplicate = NULL) {
if (!is.null(.spq_duplicate)) {
original_spq_duplicate <- .spq_duplicate
.spq_duplicate <- toupper(.spq_duplicate)
if (!(.spq_duplicate %in% c("DISTINCT", "REDUCED"))) {
rlang::abort(c(
x = sprintf("Wrong value for `.spq_duplicate` argument (%s).", original_spq_duplicate),
cli::cli_abort(c(
x = "Wrong value for {.arg .spq_duplicate} argument ({original_spq_duplicate}).",
i = 'Use either `NULL`, "distinct" or "reduced".'
)
)
Expand Down

0 comments on commit d347f9f

Please sign in to comment.