pow: Raise a Value to a Power

View source: R/S02_Math.R

powR Documentation

Raise a Value to a Power

Description

This function raises a value x to a power a. It is useful for improving the readability of code, clearly separating the base and exponent from other aspects of an equation.

Usage

pow(x, a)

Arguments

x

A numeric vector, the base values.

a

A numeric vector, the exponents.

Value

Returns the result of raising x to the power a.

Examples

2^4
pow(2, 4)

# Sometimes it can be hard to determine
# what is being raised to a power
x <- 2 * 13^4 / 8
# This function makes it easier to tell
x <- 2 * pow(13, 4) / 8

rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.