trans_loglinear {mtb} | R Documentation |
Transformation for continuous data with a finite number of distinct values
Description
trans_loglinear()
derives a log transformation from a numerical vector with a smaller number (ideally < 30) of distinct values..
The return can be used with function ggplot::scale_x_continuous()
or ggplot::scale_y_continuous()
to create a desired axis.
Usage
trans_loglinear(x = NULL, nb = 30, int = NA, scale = NA, mindist = 0.03)
Arguments
x |
A numerical vector used in a plot as (typically) |
nb |
An integer for the maximum number of breaks. Default=30 |
int |
One of
|
scale |
One of
|
mindist |
One of
|
Value
A transformation function
Examples
library(ggplot2)
pdt=data.frame(x=rep(c(0.5, 1, 10,11,12, 100, 1000), each=5))
pdt$y=pdt$x+rnorm(length(pdt$x))
t=trans_loglinear(pdt$x)
ggplot(pdt, aes(x=x, y=y))+geom_point()+scale_x_continuous(trans=t)
[Package mtb version 0.1.8 Index]