Skip to content

Commit 18bb752

Browse files
committed
better package description and some linting
1 parent a8a5149 commit 18bb752

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

DESCRIPTION

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ Title: Vectorised Nested if-else Statements Similar to SQL CASE WHEN
44
Version: 1.0.0
55
Authors@R: person("Stefan", "Fleck", email = "[email protected]", role = c("aut", "cre"))
66
Maintainer: Stefan Fleck <[email protected]>
7-
Description: A fork of the functions case_when and if_else from dplyr,
8-
but without any external dependencies.
7+
Description:
8+
Functions for vectorised conditional recoding of variables. case_when()
9+
enables you to vectorise multiple if and else statements (like `CASE WHEN`
10+
in SQL). if_else() is a stricter and more predictable
11+
version of base::ifelse() that preserves attributes. These functions are
12+
forked from 'dplyr' with all package dependencies removed and behave
13+
identically to the originals.
914
License: MIT + file LICENSE
1015
Encoding: UTF-8
1116
LazyData: true

R/case_when.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,12 @@
6363
#' TRUE ~ NA
6464
#' )
6565
#' }
66-
#'
6766
#' dat <- iris[1:5, ]
68-
#' dat$size<- case_when(
67+
#' dat$size <- case_when(
6968
#' dat$Sepal.Length < 5.0 ~ "small",
7069
#' TRUE ~ "big"
7170
#' )
7271
#' dat
73-
7472
case_when <- function(...) {
7573
formulas <- list(...)
7674
n <- length(formulas)
@@ -122,7 +120,6 @@ case_when <- function(...) {
122120
lhs_problems <- lhs_lengths %in% inconsistent_lengths
123121
rhs_problems <- rhs_lengths %in% inconsistent_lengths
124122

125-
126123
bad_calls(
127124
formulas[lhs_problems | rhs_problems],
128125
inconsistent_lengths_message(inconsistent_lengths, m)
@@ -140,4 +137,3 @@ case_when <- function(...) {
140137

141138
out
142139
}
143-

R/if_else.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,3 @@ if_else <- function(
6666

6767
out
6868
}
69-

R/utils.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ fmt_calls <- function(...){
3939

4040

4141

42-
43-
44-
4542
replace_with <- function (
4643
x,
4744
i,

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
44

5-
lest is a fork of the
6-
[dplyr](https://cran.r-project.org/web/packages/dplyr/index.html) functions
7-
`if_else()` and `case_when()`. `if_else()` is a stricter and more predictable
8-
version of `base::ifelse()` that preverves attributes (and therefore works with
9-
Dates). `case_when()` enables you to vectorise multiple `if` and `else`
10-
statements (like `CASE WHEN` in SQL).
5+
Lest provides two functions for vectorised conditional recoding of variables.
6+
`case_when()` enables you to vectorise multiple `if` and `else` statements (like
7+
`CASE WHEN` in SQL). `if_else()` is a stricter and more predictable version of
8+
`base::ifelse()` that preverves attributes (and therefore works with Dates). The
9+
functions in lest are forks of the
10+
[dplyr](https://cran.r-project.org/web/packages/dplyr/index.html) functions of
11+
the same name.
1112

1213
**lest** depends only on base, and will never add any external dependencies.
1314

man/lest-package.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)