Question

I want to use slider input (with animation) and move through years (1600-2013) in my dataset. The problem is that my data is heavily negatively skewed which is why I want to customize the 'step' incrementation inside my slider input. That means, I want something like

sequence <- c(1600,1700,1750,1800,1850,1900,1930,1950,1960,1970,1980,1990,1995,
             2000,2001,2003,2005,2006,2008,2009,2010,2011,2012,2013)

instead of

sequence <- seq(1600,2013,by=1)

if the step size = 1.

Is there a way ?

Was it helpful?

Solution

You could use something like a log scaling to determine where you sample points from, e.g.:

x <- log(seq(1,100,length.out=24))
scx <- scale(x,center=min(x),scale=diff(range(x)))
out <- round(scx * length(sequence))
out[1] <- 1

sequence[out]
# [1] 1600 1749 1802 1836 1860 1879 1895 1908 1920 1930 1939 1948 1955
#[14] 1962 1969 1975 1981 1986 1991 1996 2001 2005 2009 2013

It's not exactly what you are asked for, but it approximates it. If you change the function to use something other than log you may be able to get closer to your exact request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top