Extract hexagonal bin centroids coordinates and the corresponding standardise counts.
Source:R/2d.R
extract_hexbin_centroids.Rd
Extract hexagonal bin centroids coordinates and the corresponding standardise counts.
Arguments
- centroids_df
A tibble that contains all hexagonal bin centroid coordinates with hexagon IDs.
- counts_df
A tibble that contains hexagon IDs with the standardise number of points within each hexagon.
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
counts_df <- hb_obj$std_cts
extract_hexbin_centroids(centroids_df = all_centroids_df,
counts_df = counts_df)
#> # A tibble: 32 × 5
#> hexID c_x c_y std_counts drop_empty
#> <int> <dbl> <dbl> <dbl> <lgl>
#> 1 1 -0.1 -0.202 NA TRUE
#> 2 2 0.283 -0.202 NA TRUE
#> 3 3 0.666 -0.202 NA TRUE
#> 4 4 1.05 -0.202 NA TRUE
#> 5 5 0.0915 0.130 1 FALSE
#> 6 6 0.474 0.130 0.214 FALSE
#> 7 7 0.857 0.130 NA TRUE
#> 8 8 1.24 0.130 NA TRUE
#> 9 9 -0.1 0.461 0.214 FALSE
#> 10 10 0.283 0.461 0.429 FALSE
#> # ℹ 22 more rows