Skip to content

Commit

Permalink
docs(README): add r-universe badge and remove CodeFactor and dependen…
Browse files Browse the repository at this point in the history
…cies badges
  • Loading branch information
rossellhayes committed Aug 21, 2023
1 parent 2e5e471 commit bc8e202
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ parties <- sample(

<!-- badges: start -->
`r badge_cran_release(color = "brightgreen")`
`r badge_runiverse()`
`r badge_lifecycle("stable")`
`r badge_license(color = "blueviolet")`
`r badge_github_actions(action = "R-CMD-check")`
`r badge_codecov(branch = "main")`
`r badge_codefactor()`
`r badge_dependencies()`
<!-- badges: end -->

**incase** provides a more pipe-friendly alternative to [**dplyr**](https://github.com/tidyverse/dplyr)'s [`case_when()`](https://dplyr.tidyverse.org/reference/case_when.html) and [`if_else()`](https://dplyr.tidyverse.org/reference/if_else.html).
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<!-- badges: start -->

[![](https://www.r-pkg.org/badges/version/incase?color=brightgreen)](https://cran.r-project.org/package=incase)
[![r-universe status
badge](https://rossellhayes.r-universe.dev/badges/incase)](https://rossellhayes.r-universe.dev/incase)
[![](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![License:
MIT](https://img.shields.io/badge/license-MIT-blueviolet.svg)](https://cran.r-project.org/web/licenses/MIT)
[![R build
status](https://github.com/rossellhayes/incase/workflows/R-CMD-check/badge.svg)](https://github.com/rossellhayes/incase/actions)
[![](https://codecov.io/gh/rossellhayes/incase/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rossellhayes/incase)
[![CodeFactor](https://www.codefactor.io/repository/github/rossellhayes/incase/badge)](https://www.codefactor.io/repository/github/rossellhayes/incase)
[![Dependencies](https://tinyverse.netlify.com/badge/incase)](https://cran.r-project.org/package=incase)
<!-- badges: end -->

**incase** provides a more pipe-friendly alternative to
Expand Down Expand Up @@ -141,8 +141,8 @@ recoding discrete values.

``` r
parties
#> [1] "D" NA "I" NA "I" "D" "G" "R" "R" "G" "R" "R" "D" "I" NA "R" "D" "I" "I"
#> [20] "R"
#> [1] "G" "I" "D" "I" "R" "D" "L" "D" NA "L" NA "G" "R" NA "G" NA "L" "D" "D"
#> [20] "I"

parties %>%
switch_case(
Expand All @@ -151,10 +151,10 @@ parties %>%
c("G", "L") ~ "Other",
c("I", NA) ~ "Independent"
)
#> [1] "Democrat" "Independent" "Independent" "Independent" "Independent"
#> [6] "Democrat" "Other" "Republican" "Republican" "Other"
#> [11] "Republican" "Republican" "Democrat" "Independent" "Independent"
#> [16] "Republican" "Democrat" "Independent" "Independent" "Republican"
#> [1] "Other" "Independent" "Democrat" "Independent" "Republican"
#> [6] "Democrat" "Other" "Democrat" "Independent" "Other"
#> [11] "Independent" "Other" "Republican" "Independent" "Other"
#> [16] "Independent" "Other" "Democrat" "Democrat" "Independent"
```

`grep_case()` allows you to recode values with pattern matching.
Expand Down Expand Up @@ -188,8 +188,8 @@ factor levels. Use `ordered = TRUE` to create an ordered factor and
``` r
data <- runif(10, 0, 10)
data
#> [1] 1.386485 6.928824 7.664163 9.890110 5.088233 3.057168 9.812904 7.826100
#> [9] 5.283799 4.634477
#> [1] 3.9075340 7.4098608 2.1540250 8.4599089 3.0487929 8.9268192 9.9001603
#> [8] 9.2022173 0.3128016 5.2452107

data %>%
in_case_fct(
Expand All @@ -198,7 +198,7 @@ data %>%
default = "High",
ordered = TRUE
)
#> [1] Low Medium High High Medium Medium High High Medium Medium
#> [1] Medium High Low High Medium High High High Low Medium
#> Levels: Low < Medium < High

parties %>%
Expand All @@ -208,10 +208,10 @@ parties %>%
c("G", "L") ~ "Other",
c("I", NA) ~ "Independent"
)
#> [1] Democrat Independent Independent Independent Independent Democrat
#> [7] Other Republican Republican Other Republican Republican
#> [13] Democrat Independent Independent Republican Democrat Independent
#> [19] Independent Republican
#> [1] Other Independent Democrat Independent Republican Democrat
#> [7] Other Democrat Independent Other Independent Other
#> [13] Republican Independent Other Independent Other Democrat
#> [19] Democrat Independent
#> Levels: Democrat Republican Other Independent
```

Expand Down

0 comments on commit bc8e202

Please sign in to comment.