Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/mayer79/prettybreaks
- Owner: mayer79
- License: gpl-2.0
- Created: 2021-11-26T19:20:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-28T09:05:35.000Z (about 3 years ago)
- Last Synced: 2024-10-04T12:57:05.991Z (3 months ago)
- Language: R
- Size: 28.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE.md
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, ...)
```