R/outdata.R

Defines functions write.snp.matrix

Documented in write.snp.matrix

write.snp.matrix <-

function(x, file, append=FALSE, quote=TRUE, sep=" ", eol="\n",
         na="NA", row.names=TRUE, col.names=TRUE) {
  if (!is(x, "snp.matrix"))
    stop("argument must be a snp.matrix object")
  if (append && col.names)
    stop("col.names option is illegal in append mode")
  res <- .C("write_as_matrix", as.character(file),
     x@.Data, as.integer(nrow(x)), as.integer(ncol(x)),
     rownames(x), colnames(x), as.logical(append),
     as.logical(quote), as.character(sep), as.character(eol),
     as.character(na), as.logical(row.names), as.logical(col.names),
     logical(1), PACKAGE="chopsticks")
  error <- res[[14]]
  if (error==1)
    stop("Couldn't open output file")
  else
    c(nrow(x), ncol(x))
}

Try the chopsticks package in your browser

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

chopsticks documentation built on Nov. 8, 2020, 7:51 p.m.