Skip to content

DyfanJones/heck

Repository files navigation

heck

R-CMD-check heck status badge Codecov test coverage CRAN status

This repository was developed from the excellent extendr tutorial. This package is a thin wrapper around the rust crate heck allowing R to convert character vectors to specific cases super fast.

Installation

You can install the development version of heck like so:

r-universe:

install.packages("heck", repos = c("https://dyfanjones.r-universe.dev", "https://cran.r-project.org"))

Github:

remotes::install_github("dyfanjones/heck")

Code of Conduct

Please note that the R heck project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Example

library(heck)


x <- "Demo String"

to_kebab_case(x)
#> [1] "demo-string"
to_lower_camel_case(x)
#> [1] "demoString"
to_upper_camel_case(x)
#> [1] "DemoString"
to_pascal_case(x)
#> [1] "DemoString"
to_snake_case(x)
#> [1] "demo_string"
to_snek_case(x)
#> [1] "demo_string"
to_title_case(x)
#> [1] "Demo String"
to_train_case(x)
#> [1] "Demo-String"
to_shouty_kebab_case(x)
#> [1] "DEMO-STRING"
to_shouty_snake_case(x)
#> [1] "DEMO_STRING"