Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mayer79/prettybreaks

A small tutorial on how to create R packages
https://github.com/mayer79/prettybreaks

Last synced: 15 days ago
JSON representation

A small tutorial on how to create R packages

Awesome Lists containing this project

README

        

# prettybreaks

`prettybreaks` contains functions to create pretty breaks for numeric vectors.

Its main function `pretty2()` is similar to `base::pretty()` but allows to use different number systems and other tweaks.

## Actual goal

The package is very simple by purpose. Its main aim is to give a good starting point for building a new package, see file "packaging.R" for the full workflow.

## Installation

``` r
library(devtools)
install_github("mayer79/prettybreaks")
```

## Teaser

``` r
library(prettybreaks)

x <- 1:100

pretty2(x) # c(0, 20, 40, 60, 80, 100)
pretty2(x, n = 4) # c(0, 50, 100, 150)
pretty2(x, base = 5) # c(0, 25, 50, 75, 100)
pretty2(x, p = c(10/7, 20/7, 50/7)) # c(0., 28.57143, 57.14286, ...)
```