\encoding{UTF-8}
\name{write_kdata}
\alias{write_kdata}
\title{Write a knowledge space theory file}

\description{
  Write a data set to
  a file. The file formats are described in the \link{kstIO-package}
  information page.
}

\usage{
  write_kdata(x, 
              filename, 
              format = NULL,
              sep = ',')
}

\arguments{
  \item{x}{The data to be written, as a binary matrix.}
  \item{filename}{A character string specifying the name of the data file.}
  \item{format}{Specification of the files format. Can be "KST" or spreadsheet
    format.}]
  \item{sep}{Cell separator for CSV format.}
}

\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). \emph{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{
d <- getwd()
setwd(tempdir())
space <- kmunionclosure(phsg$basis)
df <- kmsimulate(space, 100, 0.1, 0.05)
# Write data to file
write_kdata(df, "phsg.dat") # Write in KST format
write_kdata(df, "phsg_dat.xlsx") # xlsx format
setwd(d)
}

\keyword{file}
