Updated R package. The package now works and is documented. The only implemented
method is writing ftsv datasets from R.
This commit is contained in:
parent
260e0ad715
commit
98a9d581af
|
@ -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 <einarr@pvv.ntnu.no>
|
||||
Maintainer: Einar Ryeng <einarr@pvv.ntnu.no>
|
||||
|
|
|
@ -17,23 +17,23 @@ LazyLoad: \tab yes\cr
|
|||
}
|
||||
|
||||
library(laydi)
|
||||
write.ftsv(matrix, file, ...)
|
||||
|
||||
}
|
||||
\author{
|
||||
Einar Ryeng <einarr@pvv.org>
|
||||
Einar Ryeng <einarr@pvv.org>\cr
|
||||
Arnar Flatberg <arnar.flatberg@gmail.com>
|
||||
|
||||
Maintainer: Einar Ryeng <einarr@pvv.org>
|
||||
}
|
||||
\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[<pkg>:<pkg>-package]{<pkg>}} ~~
|
||||
% ~~ Optional links to other man pages, e.g. ~~
|
||||
% ~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
|
||||
}
|
||||
\examples{
|
||||
~~ simple examples of the most important functions ~~
|
||||
library(laydi)
|
||||
write.ftsv(randu, con="/tmp/randu.ftsv")
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
Reference in New Issue