From 98a9d581afd737b210ff658f5bec018a822a3193 Mon Sep 17 00:00:00 2001 From: einarr Date: Sat, 5 Mar 2011 15:47:33 +0000 Subject: [PATCH] Updated R package. The package now works and is documented. The only implemented method is writing ftsv datasets from R. --- R/laydi/DESCRIPTION | 2 +- R/laydi/man/laydi-package.Rd | 12 +++++----- R/laydi/man/write.ftsv.Rd | 45 ++++++------------------------------ 3 files changed, 14 insertions(+), 45 deletions(-) diff --git a/R/laydi/DESCRIPTION b/R/laydi/DESCRIPTION index 3f8af87..e67f835 100644 --- a/R/laydi/DESCRIPTION +++ b/R/laydi/DESCRIPTION @@ -1,7 +1,7 @@ Package: laydi Type: Package Title: Interface to Laydi -Version: 1.0 +Version: 0.1.0 Date: 2011-03-05 Author: Einar Ryeng Maintainer: Einar Ryeng diff --git a/R/laydi/man/laydi-package.Rd b/R/laydi/man/laydi-package.Rd index 50938bd..5bb3515 100644 --- a/R/laydi/man/laydi-package.Rd +++ b/R/laydi/man/laydi-package.Rd @@ -17,23 +17,23 @@ LazyLoad: \tab yes\cr } library(laydi) +write.ftsv(matrix, file, ...) } \author{ -Einar Ryeng +Einar Ryeng \cr Arnar Flatberg Maintainer: Einar Ryeng } \references{ } -~~ Optionally other standard keywords, one per line, from file KEYWORDS in ~~ -~~ the R documentation directory ~~ \keyword{ package } \seealso{ -~~ Optional links to other man pages, e.g. ~~ -~~ \code{\link[:-package]{}} ~~ +% ~~ Optional links to other man pages, e.g. ~~ +% ~~ \code{\link[:-package]{}} ~~ } \examples{ -~~ simple examples of the most important functions ~~ +library(laydi) +write.ftsv(randu, con="/tmp/randu.ftsv") } diff --git a/R/laydi/man/write.ftsv.Rd b/R/laydi/man/write.ftsv.Rd index 256e0f3..3349cda 100644 --- a/R/laydi/man/write.ftsv.Rd +++ b/R/laydi/man/write.ftsv.Rd @@ -1,9 +1,6 @@ \name{write.ftsv} \alias{write.ftsv} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ -%% ~~function to do ... ~~ -} +\title{write.ftsv} \description{ Writes a matrix to a ftsv (laydi dataset) file. The matrix must have rownames and colnames. Rownames and colnames must be unique, and whitespace characters @@ -66,40 +63,12 @@ Einar Ryeng %% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ -##---- Should be DIRECTLY executable !! ---- -##-- ==> Define data, use random, -##-- or do help(data=index) for the standard data sets. -## The function is currently defined as -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=" ") +library(datasets) +write.ftsv(randu, "/tmp/randu.ftsv") - # 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) - } } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 } -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line + +\keyword{ IO } +\keyword{ file } +