read_kspace: Read a knowledge space file

read_kspaceR Documentation

Read a knowledge space file

Description

Read a knowledge space from a file. The file formats are described in the kstIO-package information page.

Usage

  read_kspace(filename, format = "auto", 
	      as.letters = TRUE, close = FALSE)

Arguments

filename

A character string specifying the name of the space file.

format

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

as.letters

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

close

logical, determines whether a closure under union is performed on the read structure.

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.

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

If close is TRUE, a closure under union is computed to ensure that the returned knowledge space really is one.

Value

A list with the following elements:

matrix

the read structure/data as binary matrix

sets

the read structure as kspace.

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.

Author(s)

Cord Hockemeyer cord.hockemeyer@uni-graz.at

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

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_kspace("DF7.spc") # Automatic format detection (default)
read_kspace("DF7.spc", "SRBT") # Explicit format specification
setwd(d)

kstIO documentation built on Feb. 16, 2023, 6:22 p.m.