Skip to contents

This function determines the number of bins along the x and y axes to obtain a specific number of non-empty bins.

Usage

find_non_empty_bins(data, non_empty_bins, r2, q = 0.1)

Arguments

data

A tibble that contains the embedding.

non_empty_bins

The desired number of non-empty bins.

r2

The range of the original second embedding component.

q

The buffer amount as proportion of data range.

Value

The number of bins along the x and y axes needed to achieve a specific number of non-empty bins.

Examples

scurve_umap_scaled_obj <- s_curve_obj$nldr_scaled_obj
lim1 <- scurve_umap_scaled_obj$lim1
lim2 <- scurve_umap_scaled_obj$lim2
r2 <- diff(lim2)/diff(lim1)
find_non_empty_bins(data = s_curve_noise_umap_scaled, non_empty_bins = 5,
r2 = r2)
#> Error in if (r2 > check_factor) {    a1 <- (1 + 2 * q)/(bin1 - 1)} else {    a1 <- (2 * (r2 + q * (1 + r2)))/(sqrt(3) * (bin2 - 1))}: argument is of length zero