Skip to content

matt-dray/cran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

{cran}

Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept. rostrum.blog post

An R package to convert volume measurements to crans.

Am I herring you correctly?

What’s a cran? It’s a unit of uncleaned herring. It has nothing to do with the Comprehensive R Archive Network (CRAN).

The package depends on the {units} package (site, source, R Journal) for unit conversions.

Read more in the blog post.

Install and use (don’t)

Assuming you've installed {remotes} and you’re an 18th Century fisherman, install with remotes::install_github("matt-dray/cran").

On load, you’re asked if you want to create the cran unit. Type yes and units::install_conversion_constant() will generate the unit ready for you to use in your workspace.

library(cran)
# Create the 'cran' unit of measurement for this session? yes/no: yes
# You're ready to measure uncleaned herring.

Let’s confirm that 170.5 litres is a cran:

cran_convert(value = 170.5, unit = "L")
# 1 [cran]

How many crans in 10 pints?

cran_convert(value = 10, unit = "pint")
# 0.002775229 [cran]

We can use {units} to convert the other way as well. How many cubic centimetres in a cran?

one_cran <- units::as_units(1, "cran")
units::set_units(one_cran, "cc")
# 170500 [cc]

You can remove the cran unit at any time with cran_remove(). To reinstall it, use cran_install().

About

🗑️🐟 R package: convert volume measurements to units of uncleaned herring

Resources

License

Stars

Watchers

Forks

Languages