knitr::opts_chunk$set(echo = TRUE)
set.seed(42)

Installation

# install.packages("remotes")
remotes::install_github("hsonne/findblobs")

Plot an Integer Matrix

findblobs::plot_integer_matrix(matrix(nrow = 5, byrow = TRUE, c(
  2, 2, 2, 2, 2,
  2, 0, 1, 0, 2,
  2, 1, 1, 1, 2,
  2, 0, 1, 0, 2,
  2, 2, 2, 2, 2
)))

Create Random Blobs

random_blobs <- findblobs::place_random_blobs(
  n_blobs = 5, min_fields = 3, max_fields = 10
)

Find Blobs

# Provide matrix of logical
M <- random_blobs > 0

# Find the blobs
found_blobs <- findblobs:::get_blobs(M)

# Plot the blobs. Compare with random_blobs above
findblobs::plot_integer_matrix(found_blobs)


hsonne/findblobs documentation built on April 5, 2022, 6:33 p.m.