This function raises a vector or a list of numbers to any power.

raise(x, to)

Arguments

x

Vector or list of numbers.

to

Power to raise x by.

Value

A vector (atomic, double) of the input raised to the specified power.

Examples

raise(1:4, to = 2)
#> [1] 1 4 9 16
raise(2, to = 1:4)
#> [1] 2 4 8 16
raise(as.list(1:4), to = 2)
#> [1] 1 4 9 16