Highly Performant String Case Converter

Provides a case conversion between common cases like CamelCase and snake_case. Using the 'rust crate heck' < https://github.com/withoutboats/heck> as the backend for a highly performant case conversion for 'R'.


heck

R-CMD-check heck statusbadge Codecov testcoverage CRANstatus extendr

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"

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("heck")

0.1.7 by Dyfan Jones, a month ago


https://github.com/DyfanJones/heck, https://dyfanjones.r-universe.dev/heck


Browse source code at https://github.com/cran/heck


Authors: Josiah Parry [aut] , Dyfan Jones [cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Suggests spelling, testthat

System requirements: Cargo (Rust's package manager), rustc >= 1.56.0


Suggested by arcgisrouting.


See at CRAN