R/inch_mm.R

Defines functions inch_mm

Documented in inch_mm

#' @title
#'  Millimeters to inches
#'
#' @family utils
#'
#' @description
#'  Convert length measured in \href{https://en.wikipedia.org/wiki/Millimetre}{millimeters} (mm)
#'  to \href{https://en.wikipedia.org/wiki/Inch}{inches}
#'
#' @param x
#'  length measured in \emph{millimeters}, [\emph{mm}].
#'  Type: \code{\link{assert_double}}.
#'
#' @return
#'  length in \emph{inches}, [\emph{inch}].
#'  Type: \code{\link{assert_double}}.
#'
#' @seealso
#'  \code{\link{mm_inch}} for converting \emph{inches} to \emph{mm}
#'
#' @export
#'
#' @examples
#'  inch_mm(c(25.4, 1))
#'  # [1] 1.00000000 0.03937008  # [inch]
#'
#'
inch_mm <- function(x) {
  checkmate::assert_double(x, finite = TRUE, any.missing = FALSE, min.len = 1)
  x/25.4
}

Try the pipenostics package in your browser

Any scripts or data that you put into this service are public.

pipenostics documentation built on March 2, 2021, 5:06 p.m.