Removed old laydi.R
This commit is contained in:
parent
1d94b46777
commit
6a70e7a4db
30
R/laydi.R
30
R/laydi.R
@ -1,30 +0,0 @@
|
||||
|
||||
write.ftsv <- function(data, con, name="unnamed_dataset", rowdim="rows", coldim="cols") {
|
||||
# If con is a file name, open it
|
||||
opened.here = FALSE
|
||||
if (is.character(con)){
|
||||
con = file(con, "w")
|
||||
opened.here = TRUE
|
||||
}
|
||||
|
||||
# Substitute all whitespace with underscores in identifiers
|
||||
rows <- paste(gsub("\\s", "_", rownames(data)), collapse=" ")
|
||||
cols <- paste(gsub("\\s", "_", colnames(data)), collapse=" ")
|
||||
|
||||
# Write header
|
||||
writeLines(c("# type: dataset",
|
||||
paste("# dimension:", rowdim, rows, collapse=' '),
|
||||
paste("# dimension:", coldim, cols, collapse=' '),
|
||||
paste("# name:", name, collapse=' '),
|
||||
""),
|
||||
con=con)
|
||||
|
||||
# Write matrix
|
||||
write.table(data, file=con, col.names=FALSE, row.names=FALSE, sep="\t")
|
||||
|
||||
# If con was a string, close file now
|
||||
if (opened.here)
|
||||
close(con)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user