Read a family of sets from a file. The file formats are described in the kstIO-package information page.

read_kfamset(filename, format = "auto", as.letters = TRUE)

Arguments

filename

A character string specifying the name of the space file.

format

Specification of the files format. Can be "SRBT", "KST", "matrix", or "auto" (default).

as.letters

logical, should the elements of the sets be letters or numbers?

Details

The format values "SRBT", "KST", and "matrix" refer to the different generations of file formats described in kstIO-package. The value "auto" (default) requests an automatic detection of the format by thje read_XXX function.

read_kfamset() reads any knowledge space file (space, structure, basis) and ignores any file type infor in SRBT file headers.

If as.letters is TRUE the elements of the sets are letters, otherwise numbers.

Value

A list with the following elements:

matrix

the read structure/data as binary matrix

sets

the read structure as kspace.

References

Hockemeyer, C. (2001). KST Tools User Manual (2nd ed.). https://kst.hockemeyer.at/techreports/KST-Tools_TechRep_FWF01.pdf.

Poetzi, S. \& Wesiak, G. (2001). SRbT Tools User Manual. https://kst.hockemeyer.at/techreports/SRBT-Tools_TechRep_FWF01.pdf

Note

In automatic format detection, the distinction between "matrix" and "KST" formats work somewhat heuristic. In other words, in rare cases the automatic detection might give the wrong result.

There exists no write_kfamset function on purpose.

Author

Cord Hockemeyer cord.hockemeyer@uni-graz.at

See also

space_property, kstIO-package

Examples

# Produce a space file library(kst) d <- getwd() setwd(tempdir()) data(DoignonFalmagne7) ksp <- kspace(kstructure(as.pattern(DoignonFalmagne7$K, as.set=TRUE))) write_kspace(ksp, "DF7.spc") # Write in (default) SRBT format # Read file read_kfamset("DF7.spc") # Automatic format detection (default)
#> $matrix #> a b c d e #> [1,] 0 0 0 0 0 #> [2,] 1 0 0 0 0 #> [3,] 0 1 0 0 0 #> [4,] 1 1 0 0 0 #> [5,] 1 1 1 0 0 #> [6,] 1 1 0 1 0 #> [7,] 1 1 1 1 0 #> [8,] 1 1 1 0 1 #> [9,] 1 1 1 1 1 #> #> $sets #> {{}, {"a"}, {"b"}, {"a", "b"}, {"a", "b", "c"}, {"a", "b", "d"}, {"a", #> "b", "c", "d"}, {"a", "b", "c", "e"}, {"a", "b", "c", "d", "e"}} #>
read_kfamset("DF7.spc", "SRBT") # Explicit format specification
#> $matrix #> a b c d e #> [1,] 0 0 0 0 0 #> [2,] 1 0 0 0 0 #> [3,] 0 1 0 0 0 #> [4,] 1 1 0 0 0 #> [5,] 1 1 1 0 0 #> [6,] 1 1 0 1 0 #> [7,] 1 1 1 1 0 #> [8,] 1 1 1 0 1 #> [9,] 1 1 1 1 1 #> #> $sets #> {{}, {"a"}, {"b"}, {"a", "b"}, {"a", "b", "c"}, {"a", "b", "d"}, {"a", #> "b", "c", "d"}, {"a", "b", "c", "e"}, {"a", "b", "c", "d", "e"}} #>
setwd(d)