Read a set of response patterns from a file. The file formats are described in the kstIO-package information page.

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

Arguments

filename

A character string specifying the name of the data 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.

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

Value

A binary matrix with the response patterns.

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.

Author

Cord Hockemeyer cord.hockemeyer@uni-graz.at

See also

Examples

# Produce a data file d <- getwd() setwd(tempdir()) data(DoignonFalmagne7) df <- as.binmat(DoignonFalmagne7$N.R) write_kdata(df, "DF7.dat", "matrix") # matrix format (without any headers) # Read file read_kdata("DF7.dat") # Automatic format detection (default)
#> a b c d e #> [1,] 0 0 0 0 0 #> [2,] 1 0 0 0 0 #> [3,] 0 1 0 0 0 #> [4,] 0 0 1 0 0 #> [5,] 0 0 0 1 0 #> [6,] 0 0 0 0 1 #> [7,] 1 1 0 0 0 #> [8,] 1 0 1 0 0 #> [9,] 1 0 0 1 0 #> [10,] 1 0 0 0 1 #> [11,] 0 1 1 0 0 #> [12,] 0 1 0 1 0 #> [13,] 0 1 0 0 1 #> [14,] 0 0 1 1 0 #> [15,] 0 0 1 0 1 #> [16,] 0 0 0 1 1 #> [17,] 1 1 1 0 0 #> [18,] 1 1 0 1 0 #> [19,] 1 1 0 0 1 #> [20,] 1 0 1 1 0 #> [21,] 1 0 1 0 1 #> [22,] 1 0 0 1 1 #> [23,] 0 1 1 1 0 #> [24,] 0 1 1 0 1 #> [25,] 0 1 0 1 1 #> [26,] 0 0 1 1 1 #> [27,] 1 1 1 1 0 #> [28,] 1 1 1 0 1 #> [29,] 1 1 0 1 1 #> [30,] 1 0 1 1 1 #> [31,] 0 1 1 1 1 #> [32,] 1 1 1 1 1
read_kdata("DF7.dat", "matrix") # Explicit ormat specification
#> a b c d e #> [1,] 0 0 0 0 0 #> [2,] 1 0 0 0 0 #> [3,] 0 1 0 0 0 #> [4,] 0 0 1 0 0 #> [5,] 0 0 0 1 0 #> [6,] 0 0 0 0 1 #> [7,] 1 1 0 0 0 #> [8,] 1 0 1 0 0 #> [9,] 1 0 0 1 0 #> [10,] 1 0 0 0 1 #> [11,] 0 1 1 0 0 #> [12,] 0 1 0 1 0 #> [13,] 0 1 0 0 1 #> [14,] 0 0 1 1 0 #> [15,] 0 0 1 0 1 #> [16,] 0 0 0 1 1 #> [17,] 1 1 1 0 0 #> [18,] 1 1 0 1 0 #> [19,] 1 1 0 0 1 #> [20,] 1 0 1 1 0 #> [21,] 1 0 1 0 1 #> [22,] 1 0 0 1 1 #> [23,] 0 1 1 1 0 #> [24,] 0 1 1 0 1 #> [25,] 0 1 0 1 1 #> [26,] 0 0 1 1 1 #> [27,] 1 1 1 1 0 #> [28,] 1 1 1 0 1 #> [29,] 1 1 0 1 1 #> [30,] 1 0 1 1 1 #> [31,] 0 1 1 1 1 #> [32,] 1 1 1 1 1
setwd(d)