R/tools.r

Defines functions is.true name.of.call deparse1 write.log

is.true = function(x) {
  x[is.na(x)] = FALSE
  x
}

name.of.call = function(call) {
  if (is.symbol(call)) {
    name = as.character(call)
    if (is.na(name)) return("NA")
    return(name)
  }
  name = as.character(call[[1]])
  if (name == "<-" | name == "=") {
    name = as.character(call[[3]][[1]])
  }
  name
}

deparse1 = function(call, collapse="") {
  paste0(deparse(call, width=500),collapse=collapse)
}



write.log = function(log.file,...) {
  txt = paste0(..., sep="")
  con = file(log.file,"at")
  writeLines(txt, con)
  close(con)
}
skranz/testexamples documentation built on Nov. 28, 2019, 12:12 a.m.