Skip to content

Commit

Permalink
NEWS
Browse files Browse the repository at this point in the history
====

Versioning
----------

Releases will be numbered with the following semantic versioning format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

* Breaking backward compatibility bumps the major (and resets the minor
  and patch)
* New additions without breaking backward compatibility bumps the minor
  (and resets the patch)
* Bug fixes and misc changes bumps the patch

numform 0.4.1 -
----------------------------------------------------------------

BUG FIXES

* Functions that enable the argument `less.than.replace = TRUE` would result in
  the wrong solution if the input value was negative.  This has been corrected.

* `f_quarter` didn't respect the `space` or `max` arguments for some methods.

NEW FEATURES

* `highlight_cells` added as a quick and dirty way to add cell font highlighting.

* The `collapse` and `glue` functions from the **glue** package are reexported
  for easy string manipulation.

* `f_bin` (aka `f_interval`) added for turning `"[3,5)"` form ffrom `cut` into
  a more human readable for.  There are several different forms of `f_bin` so
  use `?f_bin` to see them all.

MINOR FEATURES

* `f_denom` family of functions picks up a `less.than.replace` argument to
  replace values that say zero with a less than sing followed by a one and then
  the denomination.  For example, in `c(2, 1234)` the digit 2 becomes "<1K".

* `f_denom` picks up a `mix.denom` argument to allow for the mixing of
  denominations.  This is useful for tables with a total row that is a
  denomination higher than the rest of the column.

* `f_pp` added to lower typing on a commonly used function and to also change
  the default digits value to 0 as is typically used in plotting.

IMPROVEMENTS

CHANGES

* The argument `less_than_replace` in `f_prop2percent` & `f_percent` has been
  replaced with `less.than.replace` to make dot case consistent for arguments
  across the package.

numform 0.3.1 - 0.4.0
----------------------------------------------------------------

BUG FIXES

* `f_12_hour` did not format correctly if the vector contained missing (`NA`)
  values; see issue #12.

NEW FEATURES

* `f_year`, `f_12_hour`, `f_month`, and `f_weekday` (methods based functions)
  did not previously have closure, function retuning, forms (i.e., `ff_` form)
  making them inconsistent in usage.  These functions all have a closure, function
  returning, form.

* `f_quarter` added for working with business quarters.

* `f_degree` and friends (`f_latitude`, `f_longitude`, `f_fahrenheit`, &
  `f_celcius`) added for working with degrees in scales and tables.

MINOR FEATURES

* `f_wrap` picks up an `equal.lines` argument to add additional lines to make
  each element have the same number of new line characters.  This is useful for
  legend spacing.

* `f_wrap` picks up a `collapse` argument to `paste` + `collapse` a vector before
  processing.  This is useful wrapping subtitles or other longer text blocks.

* `f_title` picks up an `upper` and `lower` argument to allow the user to supply
  a vector of regexes to force to be upper/lower regardless of title case.

numform 0.0.6 - 0.3.0
----------------------------------------------------------------

NEW FEATURES

* `f_affirm` and `f_logical` added to convert logical and dummy values into
  yes/No or True/False strings respectively.

* alignment` added to easily align columns in table formatting functions from
  add-on R packages which may be confused by **numform**'s conversion of numeric
  to character class, though right table alignment should be maintained.

* `f_date` and `f_12_hour` added to convert dates and times into common in-text
  form.

* `f_replace` added as a ggplot2 scale `gsub` convenience function.  Defaults
  to replace '_' with ' '.

* `f_title` added as a ggplot2 scale `tools::toTitleCase` convenience function.

* `f_wrap` added as a ggplot2 scale `strwrap` + `paste(collapse =TRUE)`
  convenience function.

* `f_state` added for converting state names to their abbreviated form for plots.

* `f_year` added as a ggplot2 scale to convert to 2 digit year form convenience
  function.

* `f_abbreviation` added for converting string names to their abbreviated form.

* constants added for weekdays, months, and month abbreviations in order to make
  factor conversion of levels easier.  See `?constant_months` for more.

MINOR FEATURES

* `f_sign` picks up `negative` and `positive` assignments allowing for more
  control in format (previously +/- were assigned).  This enables the ability to
  give other characters tailored for document formats such as html, LaTeX, etc.

* `f_prop2percent` and `f_percent` pick up a logical `less_than_replace`
  argument that replaces values lower than this with a less than sign and the
  cut point specified by the `digits` argument.

CHANGES

* `f_denom` now returns `x` if the `max` < 1K.

numform 0.0.1 - 0.0.5
----------------------------------------------------------------

Format numbers for publication; includes the removal of leading zeros,
standardization of number of digits, addition of affixes, and a p-value
formatter.  These tools combine the functionality of several 'base' functions
such as paste(), format(), and sprintf() into specific use case functions that
are named in a way that is consistent with usage, making their names easy to
remember and easy to deploy.
  • Loading branch information
trinker committed Mar 17, 2018
1 parent cbe67fb commit d840cde
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 30 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: numform
Title: Tools to Format Numbers for Publication
Version: 0.4.2
Version: 0.4.3
Authors@R: c(person("Tyler", "Rinker", email = "tyler.rinker@gmail.com", role = c("aut", "cre")))
Maintainer: Tyler Rinker <tyler.rinker@gmail.com>
Description: Format numbers and plots for publication; includes the removal of leading zeros,
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export(f_ordinal)
export(f_pad_zero)
export(f_parenthesis)
export(f_percent)
export(f_pp)
export(f_prefix)
export(f_prop2percent)
export(f_pval)
Expand Down Expand Up @@ -108,6 +109,7 @@ export(ff_ordinal)
export(ff_pad_zero)
export(ff_parenthesis)
export(ff_percent)
export(ff_pp)
export(ff_prefix)
export(ff_prop2percent)
export(ff_pval)
Expand Down
7 changes: 5 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@ NEW FEATURES
* The `collapse` and `glue` functions from the **glue** package are reexported
for easy string manipulation.

* `f_bin` (aka `f_interval`) added for truning `"[3,5)"` form ffrom `cut` into
* `f_bin` (a.k.a. `f_interval`) added for turning `"[3,5)"` form ffrom `cut` into
a more human readable for. There are several different forms of `f_bin` so
use `?f_bin` to see them all.

MINOR FEATURES

* `f_denom` family of functions picks up a `less.than.replace` argument to
replace values that say zero with a less than signg folowed by a one and then
replace values that say zero with a less than sing followed by a one and then
the denomination. For example, in `c(2, 1234)` the digit 2 becomes "<1K".

* `f_denom` picks up a `mix.denom` argument to allow for the mixing of
denominations. This is useful for tables with a total row that is a
denomination higher than the rest of the column.

* `f_pp` added to lower typing on a commonly used function and to also change
the default digits value to 0 as is typically used in plotting.


IMPROVEMENTS

Expand Down
7 changes: 5 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@ numform 0.4.1 -
* The `collapse` and `glue` functions from the **glue** package are reexported
for easy string manipulation.

* `f_bin` (aka `f_interval`) added for truning `"[3,5)"` form ffrom `cut` into
* `f_bin` (a.k.a. `f_interval`) added for turning `"[3,5)"` form ffrom `cut` into
a more human readable for. There are several different forms of `f_bin` so
use `?f_bin` to see them all.

**MINOR FEATURES**

* `f_denom` family of functions picks up a `less.than.replace` argument to
replace values that say zero with a less than signg folowed by a one and then
replace values that say zero with a less than sing followed by a one and then
the denomination. For example, in `c(2, 1234)` the digit 2 becomes "&lt;1K".

* `f_denom` picks up a `mix.denom` argument to allow for the mixing of
denominations. This is useful for tables with a total row that is a
denomination higher than the rest of the column.

* `f_pp` added to lower typing on a commonly used function and to also change
the default digits value to 0 as is typically used in plotting.


IMPROVEMENTS

Expand Down
15 changes: 15 additions & 0 deletions R/f_percent.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#' f_percent(c(30, 33.45, .1), 1)
#' f_percent(c(0.0, 0, .2, -00.02, 1.122222, pi))
#' f_prop2percent(c(.30, 1, 1.01, .33, .222, .01))
#' f_pp(c(.30, 1, 1.01, .33, .222, .01))
#'
#' f_percent(c(30, 33.45, .1), digits = 0, less.than.replace = TRUE)
#' f_prop2percent(c(.30, 1, 1.01, .33, .222, .01, .0001, NA), digits = 0,
Expand Down Expand Up @@ -90,6 +91,20 @@ f_prop2percent <- function(x, digits = getOption("numformdigits"), less.than.rep
ff_prop2percent <- functionize(f_prop2percent)


#' @export
#' @include utils.R
#' @rdname f_percent
f_pp <- hijack(f_prop2percent, digits = 0)


#' @export
#' @include utils.R
#' @rdname f_percent
ff_pp <- functionize(f_pp)




replace_less_than <- function(digits = 0, prefix = c("<", ">-"), percent = FALSE, ...){

if(percent) div <- 1 else div <- 1e2
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ knitr::opts_chunk$set(fig.path = "tools/figure/", warning = FALSE)

[![Build Status](https://travis-ci.org/trinker/numform.svg?branch=master)](https://travis-ci.org/trinker/numform)
[![Coverage Status](https://coveralls.io/repos/trinker/numform/badge.svg?branch=master)](https://coveralls.io/r/trinker/numform?branch=master)
[![](http://cranlogs.r-pkg.org/badges/numform)](https://cran.r-project.org/package=numform)
[![](https://cranlogs.r-pkg.org/badges/numform)](https://cran.r-project.org/package=numform)
`r verbadge`

**numform** contains tools to assist in the formatting of numbers and plots for publication. Tools include the removal of leading zeros, standardization of number of digits, addition of affixes, and a p-value formatter. These tools combine the functionality of several 'base' functions such as `paste()`, `format()`, and `sprintf()` into specific use case functions that are named in a way that is consistent with usage, making their names easy to remember and easy to deploy.
Expand Down
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ numform
Status](https://travis-ci.org/trinker/numform.svg?branch=master)](https://travis-ci.org/trinker/numform)
[![Coverage
Status](https://coveralls.io/repos/trinker/numform/badge.svg?branch=master)](https://coveralls.io/r/trinker/numform?branch=master)
[![](http://cranlogs.r-pkg.org/badges/numform)](https://cran.r-project.org/package=numform)
[![](https://cranlogs.r-pkg.org/badges/numform)](https://cran.r-project.org/package=numform)

**numform** contains tools to assist in the formatting of numbers and
plots for publication. Tools include the removal of leading zeros,
Expand Down Expand Up @@ -75,7 +75,7 @@ usage).

<!-- html table generated in R 3.4.3 by xtable 1.8-2 package -->

<!-- Sat Mar 17 16:50:52 2018 -->
<!-- Sat Mar 17 19:30:48 2018 -->

<table>

Expand Down Expand Up @@ -103,7 +103,7 @@ f_pad_zero

<td>

f_thous
f_suffix
</td>

</tr>
Expand Down Expand Up @@ -132,7 +132,7 @@ f_parenthesis

<td>

f_title
f_thous
</td>

</tr>
Expand Down Expand Up @@ -161,7 +161,7 @@ f_percent

<td>

f_weekday
f_title
</td>

</tr>
Expand All @@ -185,12 +185,12 @@ f_latitude

<td>

f_prefix
f_pp
</td>

<td>

f_wrap
f_weekday
</td>

</tr>
Expand All @@ -214,12 +214,12 @@ f_logical

<td>

f_prop2percent
f_prefix
</td>

<td>

f_year
f_wrap
</td>

</tr>
Expand All @@ -243,12 +243,12 @@ f_longitude

<td>

f_pval
f_prop2percent
</td>

<td>

fv_num_percent
f_year
</td>

</tr>
Expand All @@ -272,12 +272,12 @@ f_mean_sd

<td>

f_quarter
f_pval
</td>

<td>

fv_percent
fv_num_percent
</td>

</tr>
Expand All @@ -301,12 +301,12 @@ f_mills

<td>

f_replace
f_quarter
</td>

<td>

fv_percent_diff
fv_percent
</td>

</tr>
Expand All @@ -330,12 +330,12 @@ f_month

<td>

f_response
f_replace
</td>

<td>

fv_runs
fv_percent_diff
</td>

</tr>
Expand All @@ -359,12 +359,12 @@ f_num

<td>

f_sign
f_response
</td>

<td>

glue
fv_runs
</td>

</tr>
Expand All @@ -388,12 +388,12 @@ f_num_percent

<td>

f_state
f_sign
</td>

<td>

highlight_cells
glue
</td>

</tr>
Expand All @@ -417,11 +417,12 @@ f_ordinal

<td>

f_suffix
f_state
</td>

<td>

highlight_cells
</td>

</tr>
Expand Down
4 changes: 2 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ citHeader("To cite numform in publications, please use:")
citEntry(entry = "manual",
title = "{numform}: A publication style number and plot formatter",
author = "Tyler W. Rinker",
note = "version 0.4.2",
note = "version 0.4.3",
year = "2018",
url = "http://github.com/trinker/numform",
textVersion = paste("Rinker, T. W. (2018).",
"numform: A publication style number and plot formatter",
"version 0.4.2.",
"version 0.4.3.",
"http://github.com/trinker/numform")
)
7 changes: 7 additions & 0 deletions man/f_percent.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d840cde

Please sign in to comment.