inst/doc/lattice_properties.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(fcaR)

## ----properties_planets-------------------------------------------------------
fc <- FormalContext$new(planets)
fc$find_concepts()

# Check properties
print(paste("Is Distributive?", fc$concepts$is_distributive()))
print(paste("Is Modular?",      fc$concepts$is_modular()))
print(paste("Is Semimodular?",  fc$concepts$is_semimodular()))
print(paste("Is Atomic?",       fc$concepts$is_atomic()))

## ----m3_example---------------------------------------------------------------
# Context for M3 (The Diamond)
# 3 objects, 3 attributes. Objects have 2 attributes each.
I_m3 <- matrix(c(
  0, 1, 1,
  1, 0, 1,
  1, 1, 0
), nrow = 3, byrow = TRUE)

fc_m3 <- FormalContext$new(I_m3)
fc_m3$find_concepts()

# M3 is Modular but NOT Distributive
print(paste("M3 Distributive:", fc_m3$concepts$is_distributive()))
print(paste("M3 Modular:",      fc_m3$concepts$is_modular()))

## ----arrow_relations----------------------------------------------------------
# Use the planets dataset
fc <- FormalContext$new(planets)
fc$calculate_arrow_relations()

# The print method now shows the arrows
print(fc)

Try the fcaR package in your browser

Any scripts or data that you put into this service are public.

fcaR documentation built on July 27, 2026, 5:06 p.m.