Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

power_trans

Create a power transformation object


Description

This function can be used to create a proper trans object that encapsulates a power transformation (x^n).

Usage

power_trans(n)

Arguments

n

The degree of the power transformation

Value

A trans object

Examples

# Power of 5 transformations
trans <- power_trans(2)
trans$transform(1:10)

# Cubic root transformation
trans <- power_trans(1 / 3)
trans$transform(1:10)

# Use it in a plot
ggplot() +
  geom_line(aes(x = 1:10, y = 1:10)) +
  scale_x_continuous(trans = power_trans(2),
                     expand = c(0, 1))

ggforce

Accelerating 'ggplot2'

v0.3.3
MIT + file LICENSE
Authors
Thomas Lin Pedersen [cre, aut] (<https://orcid.org/0000-0002-5147-4711>), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.