diff --git a/DESCRIPTION b/DESCRIPTION index d0cf19e..05bcd1b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,12 +5,12 @@ Authors@R: c(person("Tyler", "Rinker", email = "tyler.rinker@gmail.com", role = Maintainer: Tyler Rinker Description: Format numbers and plots 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. + 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. Depends: R (>= 3.2.0) Suggests: testthat -Date: 2017-12-11 +Date: 2017-12-12 License: GPL-2 LazyData: TRUE Roxygen: list(wrap = FALSE) diff --git a/NEWS b/NEWS index 9b13885..36469f3 100644 --- a/NEWS +++ b/NEWS @@ -17,7 +17,8 @@ And constructed with the following guidelines: * Bug fixes and misc changes bumps the patch -numform 0.3.1 - + +numform 0.3.1 - 0.3.3 ---------------------------------------------------------------- BUG FIXES @@ -29,8 +30,8 @@ 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 inconstent in usage. These functions all have a closure, function - retuning, form. + making them inconsistent in usage. These functions all have a closure, function + returning, form. * `f_quarter` added for working with business quarters. @@ -50,11 +51,6 @@ MINOR FEATURES a vector of regexes to force to be upper/lower regardless of title case. -IMPROVEMENTS - -CHANGES - - numform 0.0.6 - 0.3.0 diff --git a/NEWS.md b/NEWS.md index af75cab..0336bd6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,7 +17,8 @@ And constructed with the following guidelines: * Bug fixes and misc changes bumps the patch -numform 0.3.1 - + +numform 0.3.1 - 0.3.3 ---------------------------------------------------------------- **BUG FIXES** @@ -29,8 +30,8 @@ numform 0.3.1 - * `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 inconstent in usage. These functions all have a closure, function - retuning, form. + making them inconsistent in usage. These functions all have a closure, function + returning, form. * `f_quarter` added for working with business quarters. @@ -50,11 +51,6 @@ numform 0.3.1 - a vector of regexes to force to be upper/lower regardless of title case. -**IMPROVEMENTS** - -**CHANGES** - - numform 0.0.6 - 0.3.0 diff --git a/R/alignment.R b/R/alignment.R index ec55acb..f90cfa2 100644 --- a/R/alignment.R +++ b/R/alignment.R @@ -2,7 +2,7 @@ #' #' Many of the specialized functions in numform can change the type of the data #' from numeric to character causing the table formatting functions in various -#' add-on packages to improperly align the elements. This function pases the +#' add-on packages to improperly align the elements. This function passes the #' columns with a regular expression to detect alignment regardless of column #' class. #' diff --git a/R/as_factor.R b/R/as_factor.R index 462747f..5165002 100644 --- a/R/as_factor.R +++ b/R/as_factor.R @@ -5,7 +5,7 @@ #' #' @param x A vector of weekdays or months. #' @param shift Shift the levels to the right or left. Useful for setting the -#' week begining to something besides Sunday. Use -1 to set to Monday instead. +#' week beginning to something besides Sunday. Use -1 to set to Monday instead. #' @param \ldots ignored. #' @return Returns a factor vector with levels set. #' @export diff --git a/R/f_12_hour.R b/R/f_12_hour.R index e6a3fce..446301d 100644 --- a/R/f_12_hour.R +++ b/R/f_12_hour.R @@ -2,7 +2,7 @@ #' #' Format times to the typical 12 hour '%I:%M %p' in-text format. #' -#' @param x A vector of coercable times. +#' @param x A vector of coercible times. #' @param format A character string specifying the time output format. #' @param pad.char A character to use for leading padding if lengths of output #' are unequal. diff --git a/R/f_comma.R b/R/f_comma.R index 66e88cb..e13eebf 100644 --- a/R/f_comma.R +++ b/R/f_comma.R @@ -6,7 +6,7 @@ #' @param mark The character to include every n places. #' @param prefix A string to append to the front of elements. #' @param \ldots Other arguments passed to \code{\link[base]{prettyNum}}. -#' @return Returns a comma separted string of publication ready digits. +#' @return Returns a comma separated string of publication ready digits. #' @export #' @rdname f_comma #' @seealso \code{\link[base]{prettyNum}} diff --git a/R/f_date.R b/R/f_date.R index e6b429f..a263d32 100644 --- a/R/f_date.R +++ b/R/f_date.R @@ -2,7 +2,7 @@ #' #' Format dates to the typical '%B %d, %Y in-text format. #' -#' @param x A vector of coercable dates. +#' @param x A vector of coercible dates. #' @param format A character string specifying the date output format. #' @param \ldots Other arguments passed to \code{\link[base]{as.Date}}. #' @return Returns a string of publication ready dates. diff --git a/R/f_num.R b/R/f_num.R index a2343b1..1450401 100644 --- a/R/f_num.R +++ b/R/f_num.R @@ -7,7 +7,7 @@ #' @param digits The number of digits to use. Defaults to 1. Can be set #' globally via: \code{options(numformdigits = n)} where n is the number of #' digits beyond the decimal point to include. -#' @param p A string to paste at the begining of the output from \code{f_num}. +#' @param p A string to paste at the beginning of the output from \code{f_num}. #' @param s A string to paste at the end of the output from \code{f_num}. #' @param pad.char A character to use for leading padding if lengths of output #' are unequal. diff --git a/R/f_parenthesis.R b/R/f_parenthesis.R index 4f16b4c..5d19ac2 100644 --- a/R/f_parenthesis.R +++ b/R/f_parenthesis.R @@ -12,10 +12,10 @@ #' @param sep The separator between the first number and the leading parenthesis. #' @param x_prefix A constant to place before each value in the x vector. #' @param y_prefix A constant to place before each value in the y -#' vector inside of the prenthesis. +#' vector inside of the parenthesis. #' @param prop_fun The proportion function to convert the y y vector in #' \code{f_num_percent}. Default is \code{f_prop2percent}. \code{f_percent} is -#' used for when the values are alrey percentages. +#' used for when the values are already percentages. #' @param \ldots ignored. #' @return Returns a vector of parenthesis combined strings using vector x and y. #' @rdname f_parenthesis diff --git a/R/f_title.R b/R/f_title.R index 59b48f1..22eb7d3 100644 --- a/R/f_title.R +++ b/R/f_title.R @@ -4,10 +4,10 @@ #' #' @param x A vector of text strings. #' @param upper A vector of regular expression to convert to upper case that -#' would otherwise be lower cased (this should be targetted at the initial output, +#' would otherwise be lower cased (this should be targeted at the initial output, #' not the input). #' @param lower A vector of regular expression to convert to lower case that -#' would otherwise be upper cased (this should be targetted at the initial output, +#' would otherwise be upper cased (this should be targeted at the initial output, #' not the input). #' @param \ldots ignored. #' @return Returns a string vector with characters replaced. diff --git a/R/f_wrap.R b/R/f_wrap.R index e96e84e..c2663c9 100644 --- a/R/f_wrap.R +++ b/R/f_wrap.R @@ -16,7 +16,7 @@ #' the max number of lines. This is useful for legend spacing. #' @param collapse logical. If \code{TRUE} then \code{x} is collapsed via #' \code{paste(x, collapse = ' ')} before processing. This is useful for -#' muti-line text wraping of longer subtitles. +#' muti-line text wrapping of longer subtitles. #' @param \ldots Other arguments passed to \code{\link[base]{strwrap}}. #' @return Returns a string vector with wrapped new line characters. #' @rdname f_wrap diff --git a/R/fv_num_percent.R b/R/fv_num_percent.R index 60f25d2..a5fe691 100644 --- a/R/fv_num_percent.R +++ b/R/fv_num_percent.R @@ -7,7 +7,7 @@ #' @param x_digits The number of digits to round the x vector. #' @param y_digits The number of digits to round the y vector. #' @param sep The separator between the first number and the leading parenthesis. -#' @param comma logiccal. If \code{TRUE} the leading number is comma separated. +#' @param comma logical. If \code{TRUE} the leading number is comma separated. #' @param \ldots ignored. #' @rdname fv_num_percent #' @return Returns a vector of parenthesis combined strings using vector x diff --git a/README.md b/README.md index 2926c05..42b44f3 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,8 @@ arguments but returns a function instead. This is useful for passing in to **ggplot2** `scale_x/y_type` functions (see [Plotting](#plotting) for usage). - - + +
@@ -432,12 +432,12 @@ alignment. --++-+@@ -574,11 +574,11 @@ alignment. data.frame(stringsAsFactors = FALSE, check.names = FALSE) %>% pander::pander(split.tables = Inf, justify = alignment(.)) -
+
---+++ @@ -696,7 +696,7 @@ Plotting ## 10 406613.1 1999-08-19 Site 3 $487,000 487K $487K A ## # ... with 9,990 more rows, and 1 more variables: abb_week -![](tools/figure/unnamed-chunk-21-1.png) +![](tools/figure/unnamed-chunk-14-1.png) library(tidyverse); library(viridis) @@ -754,7 +754,7 @@ Plotting ), width = 85, collapse = TRUE) ) -![](tools/figure/unnamed-chunk-22-1.png) +![](tools/figure/unnamed-chunk-15-1.png) library(tidyverse); library(gridExtra) @@ -828,7 +828,7 @@ Plotting ) -![](tools/figure/unnamed-chunk-23-1.png) +![](tools/figure/unnamed-chunk-16-1.png) set.seed(10) dat <- data_frame( @@ -857,7 +857,7 @@ Plotting subtitle = 'Subtitles: For that extra professional look.' ) -![](tools/figure/unnamed-chunk-24-1.png) +![](tools/figure/unnamed-chunk-17-1.png) library(tidyverse); library(viridis) @@ -891,7 +891,7 @@ Plotting panel.grid.major.x = element_blank() ) -![](tools/figure/unnamed-chunk-25-1.png) +![](tools/figure/unnamed-chunk-18-1.png) library(tidyverse); library(maps) @@ -902,7 +902,7 @@ Plotting scale_y_continuous(labels = f_latitude) + scale_x_continuous(labels = f_longitude) -![](tools/figure/unnamed-chunk-26-1.png) +![](tools/figure/unnamed-chunk-19-1.png) Modeling -------- diff --git a/man/alignment.Rd b/man/alignment.Rd index e2977f8..f55c61c 100644 --- a/man/alignment.Rd +++ b/man/alignment.Rd @@ -30,7 +30,7 @@ Returns a vector of lefts and rights or a string (if \code{sep} is not \description{ Many of the specialized functions in numform can change the type of the data from numeric to character causing the table formatting functions in various -add-on packages to improperly align the elements. This function pases the +add-on packages to improperly align the elements. This function passes the columns with a regular expression to detect alignment regardless of column class. } diff --git a/man/as_factor.Rd b/man/as_factor.Rd index b1952cc..2bf2c90 100644 --- a/man/as_factor.Rd +++ b/man/as_factor.Rd @@ -10,7 +10,7 @@ as_factor(x, shift = 0, ...) \item{x}{A vector of weekdays or months.} \item{shift}{Shift the levels to the right or left. Useful for setting the -week begining to something besides Sunday. Use -1 to set to Monday instead.} +week beginning to something besides Sunday. Use -1 to set to Monday instead.} \item{\ldots}{ignored.} } diff --git a/man/f_12_hour.Rd b/man/f_12_hour.Rd index 5fe0eaf..a254f02 100644 --- a/man/f_12_hour.Rd +++ b/man/f_12_hour.Rd @@ -22,7 +22,7 @@ f_12_hour(x = Sys.time(), format = "\%I:\%M \%p", pad.char = "", ...) ff_12_hour(format = "\%I:\%M \%p", pad.char = "", ...) } \arguments{ -\item{x}{A vector of coercable times.} +\item{x}{A vector of coercible times.} \item{format}{A character string specifying the time output format.} diff --git a/man/f_comma.Rd b/man/f_comma.Rd index 16470cc..1a0d352 100644 --- a/man/f_comma.Rd +++ b/man/f_comma.Rd @@ -19,7 +19,7 @@ ff_comma(...) \item{\ldots}{Other arguments passed to \code{\link[base]{prettyNum}}.} } \value{ -Returns a comma separted string of publication ready digits. +Returns a comma separated string of publication ready digits. } \description{ Add commas to larger integers. diff --git a/man/f_date.Rd b/man/f_date.Rd index 982bd66..f0eca93 100644 --- a/man/f_date.Rd +++ b/man/f_date.Rd @@ -10,7 +10,7 @@ f_date(x = Sys.Date(), format = "\%B \%d, \%Y", ...) ff_date(...) } \arguments{ -\item{x}{A vector of coercable dates.} +\item{x}{A vector of coercible dates.} \item{format}{A character string specifying the date output format.} diff --git a/man/f_num.Rd b/man/f_num.Rd index acb01f0..ef759ec 100644 --- a/man/f_num.Rd +++ b/man/f_num.Rd @@ -17,7 +17,7 @@ ff_num(...) globally via: \code{options(numformdigits = n)} where n is the number of digits beyond the decimal point to include.} -\item{p}{A string to paste at the begining of the output from \code{f_num}.} +\item{p}{A string to paste at the beginning of the output from \code{f_num}.} \item{s}{A string to paste at the end of the output from \code{f_num}.} diff --git a/man/f_parenthesis.Rd b/man/f_parenthesis.Rd index a92f53d..543a74b 100644 --- a/man/f_parenthesis.Rd +++ b/man/f_parenthesis.Rd @@ -34,7 +34,7 @@ ff_num_percent(...) \item{x_prefix}{A constant to place before each value in the x vector.} \item{y_prefix}{A constant to place before each value in the y -vector inside of the prenthesis.} +vector inside of the parenthesis.} \item{x_digits}{The number of digits to round the x vector.} @@ -42,7 +42,7 @@ vector inside of the prenthesis.} \item{prop_fun}{The proportion function to convert the y y vector in \code{f_num_percent}. Default is \code{f_prop2percent}. \code{f_percent} is -used for when the values are alrey percentages.} +used for when the values are already percentages.} \item{\ldots}{ignored.} } diff --git a/man/f_title.Rd b/man/f_title.Rd index fc8eaa1..9ce643c 100644 --- a/man/f_title.Rd +++ b/man/f_title.Rd @@ -13,11 +13,11 @@ ff_title(...) \item{x}{A vector of text strings.} \item{upper}{A vector of regular expression to convert to upper case that -would otherwise be lower cased (this should be targetted at the initial output, +would otherwise be lower cased (this should be targeted at the initial output, not the input).} \item{lower}{A vector of regular expression to convert to lower case that -would otherwise be upper cased (this should be targetted at the initial output, +would otherwise be upper cased (this should be targeted at the initial output, not the input).} \item{\ldots}{ignored.} diff --git a/man/f_wrap.Rd b/man/f_wrap.Rd index 0ee9e3c..f8aa85e 100644 --- a/man/f_wrap.Rd +++ b/man/f_wrap.Rd @@ -30,7 +30,7 @@ the max number of lines. This is useful for legend spacing.} \item{collapse}{logical. If \code{TRUE} then \code{x} is collapsed via \code{paste(x, collapse = ' ')} before processing. This is useful for -muti-line text wraping of longer subtitles.} +muti-line text wrapping of longer subtitles.} \item{\ldots}{Other arguments passed to \code{\link[base]{strwrap}}.} } diff --git a/man/fv_num_percent.Rd b/man/fv_num_percent.Rd index 66d97ab..979922e 100644 --- a/man/fv_num_percent.Rd +++ b/man/fv_num_percent.Rd @@ -19,7 +19,7 @@ ffv_num_percent(...) \item{sep}{The separator between the first number and the leading parenthesis.} -\item{comma}{logiccal. If \code{TRUE} the leading number is comma separated.} +\item{comma}{logical. If \code{TRUE} the leading number is comma separated.} \item{\ldots}{ignored.} } diff --git a/tools/figure/unnamed-chunk-14-1.png b/tools/figure/unnamed-chunk-14-1.png index 4ebc2bc..b90ece2 100644 Binary files a/tools/figure/unnamed-chunk-14-1.png and b/tools/figure/unnamed-chunk-14-1.png differ diff --git a/tools/figure/unnamed-chunk-15-1.png b/tools/figure/unnamed-chunk-15-1.png index 586c31f..46f2847 100644 Binary files a/tools/figure/unnamed-chunk-15-1.png and b/tools/figure/unnamed-chunk-15-1.png differ diff --git a/tools/figure/unnamed-chunk-16-1.png b/tools/figure/unnamed-chunk-16-1.png index 98706d7..7c85244 100644 Binary files a/tools/figure/unnamed-chunk-16-1.png and b/tools/figure/unnamed-chunk-16-1.png differ diff --git a/tools/figure/unnamed-chunk-17-1.png b/tools/figure/unnamed-chunk-17-1.png new file mode 100644 index 0000000..0bfe1bc Binary files /dev/null and b/tools/figure/unnamed-chunk-17-1.png differ diff --git a/tools/figure/unnamed-chunk-18-1.png b/tools/figure/unnamed-chunk-18-1.png new file mode 100644 index 0000000..f1c342d Binary files /dev/null and b/tools/figure/unnamed-chunk-18-1.png differ diff --git a/tools/figure/unnamed-chunk-19-1.png b/tools/figure/unnamed-chunk-19-1.png new file mode 100644 index 0000000..29df1b6 Binary files /dev/null and b/tools/figure/unnamed-chunk-19-1.png differ diff --git a/tools/figure/unnamed-chunk-37-1.png b/tools/figure/unnamed-chunk-37-1.png new file mode 100644 index 0000000..b90ece2 Binary files /dev/null and b/tools/figure/unnamed-chunk-37-1.png differ diff --git a/tools/figure/unnamed-chunk-38-1.png b/tools/figure/unnamed-chunk-38-1.png new file mode 100644 index 0000000..46f2847 Binary files /dev/null and b/tools/figure/unnamed-chunk-38-1.png differ diff --git a/tools/figure/unnamed-chunk-39-1.png b/tools/figure/unnamed-chunk-39-1.png new file mode 100644 index 0000000..7c85244 Binary files /dev/null and b/tools/figure/unnamed-chunk-39-1.png differ diff --git a/tools/figure/unnamed-chunk-40-1.png b/tools/figure/unnamed-chunk-40-1.png new file mode 100644 index 0000000..0bfe1bc Binary files /dev/null and b/tools/figure/unnamed-chunk-40-1.png differ diff --git a/tools/figure/unnamed-chunk-41-1.png b/tools/figure/unnamed-chunk-41-1.png new file mode 100644 index 0000000..f1c342d Binary files /dev/null and b/tools/figure/unnamed-chunk-41-1.png differ diff --git a/tools/figure/unnamed-chunk-42-1.png b/tools/figure/unnamed-chunk-42-1.png new file mode 100644 index 0000000..29df1b6 Binary files /dev/null and b/tools/figure/unnamed-chunk-42-1.png differ