Skip to contents

Extract hexagonal bin mean coordinates and the corresponding standardize counts.

Usage

extract_hexbin_mean(data_hb, counts_df, centroids_df)

Arguments

data_hb

A tibble with embedding components and hexagonal bin IDs.

counts_df

A tibble that contains hexagon IDs with the standardise number of points within each hexagon.

centroids_df

A tibble that contains all hexagonal bin centroid coordinates with hexagon IDs.

Value

A tibble contains hexagon ID, bin mean coordinates, and standardize counts.

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, q = 0.1)
all_centroids_df <- hb_obj$centroids
umap_with_hb_id <- hb_obj$data_hb_id
counts_df <- hb_obj$std_cts
extract_hexbin_mean(data_hb = umap_with_hb_id, counts_df = counts_df,
centroids_df = all_centroids_df)
#> # A tibble: 32 × 5
#>    hexID     c_x    c_y std_counts drop_empty
#>    <int>   <dbl>  <dbl>      <dbl> <lgl>     
#>  1     1 NA      NA         NA     TRUE      
#>  2     2 NA      NA         NA     TRUE      
#>  3     3 NA      NA         NA     TRUE      
#>  4     4 NA      NA         NA     TRUE      
#>  5     5  0.133   0.138      1     FALSE     
#>  6     6  0.291   0.178      0.214 FALSE     
#>  7     7 NA      NA         NA     TRUE      
#>  8     8 NA      NA         NA     TRUE      
#>  9     9  0.0278  0.348      0.214 FALSE     
#> 10    10  0.330   0.419      0.429 FALSE     
#> # ℹ 22 more rows