\encoding{UTF-8}
\name{read_surmiserelation}
\alias{read_surmiserelation}
\title{Read surmise relation file}

\description{
  Read a surmise relation from
  a file. The file formats are described in the \link{kstIO-package}
  information page.
}

\usage{
  read_surmiserelation(filename, 
                       format = "auto", 
                       header = TRUE,
                       as.letters = TRUE,
                       sep = ',')
}

\arguments{
  \item{filename}{A character string specifying the name of the base file.}

  \item{format}{Specification of the files format. Can be "SRBT", 
    "matrix", "CSV", or "auto" (default).}
  \item{header}{Whether spreadsheet file contains header row.}
  \item{as.letters}{logical, should the elements of the sets be letters
                    or numbers? Defaults to TRUE.}
  \item{sep}{Cell separator for CSV files.}
}

\details{
  The \code{format} values \code{"SRBT"} and 
  \code{"matrix"} refer to the different generations of file formats 
  described in \link{kstIO-package}.  The value \code{"auto"} (default)
  requests an automatic detection of the format by the \code{read_XXX}
  function. 

  If \code{as.letters} is \code{TRUE} (default), the elements of the sets are letters,
  otherwise numbers.

 The relation is always closed under reflexivity and transitivity.
}

\value{
	The incidence matrix of the surmise relation.
}

\references{
  Hockemeyer, C. (2001). \emph{KST Tools User Manual} (2nd ed.). 
  \url{https://resources.cord-hockemeyer.info/techreports/KST-Tools_TechRep_FWF01.pdf}.

  Poetzi, S. & Wesiak, G. (2001). SRbT Tools User Manual.
  \url{https://resources.cord-hockemeyer.info/techreports/SRBT-Tools_TechRep_FWF01.pdf}
}


\author{Cord Hockemeyer \email{cord.hockemeyer@uni-graz.at}}

\seealso{\link{kstIO-package}}

\examples{
# Produce a relation file
d <- getwd()
setwd(tempdir())
r <- kmsurmiserelation(phsg$basis)
write_surmiserelation(r, "phsg.rel", "SRBT") # SRBT format
# Read file
read_surmiserelation("phsg.rel") # Automatic format detection
read_surmiserelation("phsg.rel", "SRBT") # Explicit format specification
setwd(d)
}

\keyword{file}
