opt_bin_diff: Finds the number of bins in x and y direction which gives the...

Description Usage Arguments Value Examples

View source: R/opt_diff.r

Description

This function finds the optimal number of bins in both x and y direction which should be used to calculate the binned distance. The binned distance is calculated for each combination of provided choices of number of bins in x and y direction and finds the difference using calc_diff for each combination. The combination for which the difference is maximum should be used.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
opt_bin_diff(
  lineup.dat,
  var,
  xlow,
  xhigh,
  ylow,
  yhigh,
  pos,
  plot = FALSE,
  m = 20
)

Arguments

lineup.dat

lineup data to get the lineup

var

a list of names of the variables to be used to calculate the difference

xlow

the lowest value of number of bins on the x-direction

xhigh

the highest value of number of bins on the x-direction

ylow

the lowest value of number of bins on the y-direction

yhigh

the highest value of number of bins on the y-direction

pos

position of the true plot in the lineup

plot

LOGICAL; if true, returns a tile plot for the combinations of number of bins with the differences as weights

m

number of plots in the lineup, by default m = 20

Value

a dataframe with the number of bins and differences the maximum mean distance of the null plots

Examples

1
2
3
4
if(require('dplyr')){
opt_bin_diff(lineup(null_permute('mpg'), mtcars, pos = 1), var = c('mpg', 'wt'),
2, 5, 4, 8, pos = 1, plot = TRUE, m = 8)
}

nullabor documentation built on Feb. 26, 2020, 1:07 a.m.