add package doco skeleton and images
This commit is contained in:
@@ -37,28 +37,33 @@ pretty_per <- function(x, ndigit = 1) {
|
||||
options(knitr.kable.NA = "-")
|
||||
|
||||
|
||||
#' Title
|
||||
#' Zero out missing values
|
||||
#'
|
||||
#' @param x
|
||||
#' @param x a numeric vector with missing values
|
||||
#'
|
||||
#' @return
|
||||
#' @return a numeric vector with missing values replaced by 0
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' na_zero(1:10)
|
||||
#' na_zero(c(NA, NA, 2:10))
|
||||
na_zero <- function(x) {
|
||||
x[is.na(x)] <- 0
|
||||
return(x)
|
||||
}
|
||||
|
||||
|
||||
#' Title
|
||||
#' Prettify count data
|
||||
#' Make integers propertly formatted as strings which include commas suitable for printing
|
||||
#' @param x a numeric vector
|
||||
#'
|
||||
#' @param x
|
||||
#'
|
||||
#' @return
|
||||
#' @return a character vector with commas introduced in place positions in the numbers
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' pretty_count(10)
|
||||
#' pretty_count(1000)
|
||||
#' pretty_count(1e8)
|
||||
pretty_count <- function(x) {
|
||||
x <- prettyNum(x, big.mark = ",")
|
||||
return(x)
|
||||
|
||||
Reference in New Issue
Block a user