R/dfWriteDat.R

dfWriteDat <- function(Data, File, SubID='SubID')
#writes a data frame as a tab-delimited data file with standard Curtin lab format
#Will add rownames as a variable named SubID
{
  if(!is.element(SubID, names(Data)) && !is.null(SubID))
  {
    dNew = as.data.frame(rownames(Data))
    names(dNew)[1] =  SubID
    dNew[2:(ncol(Data)+1)] = Data
    Data = dNew
  }

  write.table(Data, file = File, append = FALSE, quote = TRUE, sep = '\t',
                 eol = "\n", na = "NA", dec = ".", row.names = FALSE,
                 col.names = TRUE)
}

Try the lmSupport package in your browser

Any scripts or data that you put into this service are public.

lmSupport documentation built on May 2, 2019, 2:14 p.m.