Bank Slopes to 45 degrees

# Use the classic sunspot data from Cleveland's orig paper
x <- seq_along(sunspot.year)
y <- as.numeric(sunspot.year)
# Without banking
m <- qplot(x, y, geom='line')
m

plot of chunk bank_slopes

## Using the default method, Median Absolute Slope
ratio <- bank_slopes(x, y)
m + coord_fixed(ratio = ratio)

plot of chunk bank_slopes

## Alternative methods to calculate the banking
bank_slopes(x, y, method='ms')
## [1] 0.04554598
## Using culling
bank_slopes(x, y, method='ms', cull=TRUE)
## [1] 0.04554598
## Average Absolute Slope
bank_slopes(x, y, method='as')
## [1] 0.03682336
bank_slopes(x, y, method='as', cull=TRUE)
## [1] 0.0366955
## Average Orientation
bank_slopes(x, y, method='ao')
## [1] 0.03921636
bank_slopes(x, y, method='ao', cull=TRUE)
## [1] 0.03920218
## Average Orientation (Weighted)
bank_slopes(x, y, method='ao', weight=TRUE)
## [1] 0.03921636
bank_slopes(x, y, method='ao', cull=TRUE, weight=TRUE)
## [1] 0.03920218
## Global Orientation Resolution
bank_slopes(x, y, method='gor')
## [1] 0.05008701
bank_slopes(x, y, method='gor', cull=TRUE)
## [1] 0.0500918
## Local Orientation Resolution
bank_slopes(x, y, method='lor')
## [1] 0.04771283
bank_slopes(x, y, method='lor', cull=TRUE)
## [1] 0.0477209