# make a matroid with rank 3
mat = matroid( classics.genlist[['RT']] )
# the ground set itself should have rank 3
rank( mat, getground(mat) )
## [1] 3
# single points should have rank 1 (there are no loops)
rank( mat, as.list(getground(mat)) )
## [1] 1 1 1 1 1 1
# all hyperplanes should have rank 2
rank( mat, gethyperplane(mat) )
## [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
# a point not in the ground set should have rank NA
# and the emtpy set should have rank 0
rank( mat, list(100L,integer(0)) )
## 1 of 1 subsets are not a subset of ground.
## [1] NA 0
Run the code above in your browser using DataLab