R/read.Chloe.properties.R

Defines functions read.Chloe.properties

Documented in read.Chloe.properties

#' Reading the proprieties file generated by Chloe
#'
#' `read.Chloe.properties()` Return a vector of the metrics or the scales you used in Chloe for your
#' analysis
#'
#' @param path The path to your proprieties file generated in Chloe for your analysis
#'
#' @param type Argument specifying if you want to read the "metrics" or the "Distance" used for
#' your analysis
#'
#' @return Return a vector of the metrics or scales used in Chloe in your analysis.
#' @author Pierre-Gilles Lemasle <pg.lemasle@gmail.com>
#' @export
read.Chloe.properties=function(path,type){
  temp=file(path,open="r")
  test=readLines(temp)
  if(type=="Distance"){
    i=grepl("window_sizes=",test)
    word="window_sizes="
  }
  if(type=="Metrics"){
    i=grepl("metrics=",test)
    word="metrics="
  }
  temp=file(path,open="r")
  test=readLines(temp)[i]
  close(temp)
  test=gsub('"', "", test, fixed=TRUE)
  test=gsub("\\{", '("', test)
  test=gsub("\\}", '")', test)
  test=gsub("\\;", '","', test)
  test=gsub(word, "", test)
  test=paste0("c",test,sep = "")
  test=eval(parse(text = test))
  # test=sub("-", ".",test)
  # test=sub("-", ".",test)
  test
}
Pintademijote/multipack documentation built on Sept. 24, 2019, 7:54 a.m.