From 39192dec55f231bc62adb55325ae2c64e1cf7756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul-Christian=20B=C3=BCrkner?= Date: Wed, 18 Jan 2017 17:11:39 +0100 Subject: [PATCH] export 'logm1' und 'expp1' --- NAMESPACE | 2 ++ R/misc.R | 24 ++++++++++++++++++++---- man/expp1.Rd | 15 +++++++++++++++ man/logm1.Rd | 18 ++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 man/expp1.Rd create mode 100644 man/logm1.Rd diff --git a/NAMESPACE b/NAMESPACE index ccb9eebe3..471a1a954 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -97,6 +97,7 @@ export(cumulative) export(exgaussian) export(exponential) export(expose_functions) +export(expp1) export(fixef) export(frechet) export(geometric) @@ -117,6 +118,7 @@ export(is.cor_fixed) export(launch_shiny) export(log_lik) export(log_posterior) +export(logm1) export(lognormal) export(loo) export(make_stancode) diff --git a/R/misc.R b/R/misc.R index 2745f3c66..d28c860d7 100644 --- a/R/misc.R +++ b/R/misc.R @@ -331,10 +331,26 @@ log1m <- function(x) { log(1 - x) } -logm1 <- function(x) { - log(x - 1) -} - +#' Logarithm with a minus one offset. +#' +#' Computes \code{log(x - 1)}. +#' +#' @param x A numeric or complex vector. +#' @param base A positive or complex number: the base with respect to which +#' logarithms are computed. Defaults to \emph{e} = \code{exp(1)}. +#' +#' @export +logm1 <- function(x, base = exp(1)) { + log(x - 1, base = base) +} + +#' Exponential function plus one. +#' +#' Computes \code{exp(x) + 1}. +#' +#' @param x A numeric or complex vector. +#' +#' @export expp1 <- function(x) { exp(x) + 1 } diff --git a/man/expp1.Rd b/man/expp1.Rd new file mode 100644 index 000000000..c0e38a945 --- /dev/null +++ b/man/expp1.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/misc.R +\name{expp1} +\alias{expp1} +\title{Exponential function plus one.} +\usage{ +expp1(x) +} +\arguments{ +\item{x}{A numeric or complex vector.} +} +\description{ +Computes \code{exp(x) + 1}. +} + diff --git a/man/logm1.Rd b/man/logm1.Rd new file mode 100644 index 000000000..c0f9f3ae0 --- /dev/null +++ b/man/logm1.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/misc.R +\name{logm1} +\alias{logm1} +\title{Logarithm with a minus one offset.} +\usage{ +logm1(x, base = exp(1)) +} +\arguments{ +\item{x}{A numeric or complex vector.} + +\item{base}{A positive or complex number: the base with respect to which +logarithms are computed. Defaults to \emph{e} = \code{exp(1)}.} +} +\description{ +Computes \code{log(x - 1)}. +} +