Skip to contents

This function identifies hexagons with low density based on the mean density of their neighboring hexagons.

Usage

find_low_dens_hex(df_bin_centroids_all, bin1, df_bin_centroids_low)

Arguments

df_bin_centroids_all

The tibble that contains all hexagonal bin centroids.

bin1

Number of bins along the x-axis for hexagon binning.

df_bin_centroids_low

The tibble that contains identified low-density hexagonal bin centroids.

Value

A vector containing the IDs of hexagons to be removed after investigating their neighboring bins.

Examples

r2 <- diff(range(s_curve_noise_umap$UMAP2))/diff(range(s_curve_noise_umap$UMAP1))
num_bins_x <- 4
hb_obj <- hex_binning(data = s_curve_noise_umap_scaled, bin1 = num_bins_x,
r2 = r2)
all_centroids_df <- hb_obj$centroids
counts_df <- hb_obj$std_cts
df_bin_centroids <- extract_hexbin_centroids(centroids_df = all_centroids_df,
counts_df = counts_df) |>
dplyr::filter(drop_empty == FALSE)
df_bin_centroids_low <- df_bin_centroids |>
dplyr::filter(std_counts <= 0.43)
find_low_dens_hex(df_bin_centroids_all = df_bin_centroids, bin1 = num_bins_x,
df_bin_centroids_low = df_bin_centroids_low)
#> integer(0)