###
### read_surmisefunction.R
###
### dependencies: openxlsx, openODS, tools
###

read_surmisefunction <- function (filename) {
  ext <- tolower(file_ext(filename))
  if (ext == "csv" ) {
    sf <- read.csv(filename)
  } else if (ext == "ods") {
    sf <- read_ods(filename)
  } else if (ext == "xlsx") {
    sf <- read_xlsx(filename)
  } else stop("Unknown file extension.")
  class(sf) <- unique(c("kmsurmisefunction", class(sf)))
  sf
}