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
|
Package: laydi
|
||||||
Type: Package
|
Type: Package
|
||||||
Title: Interface to Laydi
|
Title: Interface to Laydi
|
||||||
Version: 1.0
|
Version: 0.1.0
|
||||||
Date: 2011-03-05
|
Date: 2011-03-05
|
||||||
Author: Einar Ryeng <einarr@pvv.ntnu.no>
|
Author: Einar Ryeng <einarr@pvv.ntnu.no>
|
||||||
Maintainer: Einar Ryeng <einarr@pvv.ntnu.no>
|
Maintainer: Einar Ryeng <einarr@pvv.ntnu.no>
|
||||||
|
|
|
@ -17,23 +17,23 @@ LazyLoad: \tab yes\cr
|
||||||
}
|
}
|
||||||
|
|
||||||
library(laydi)
|
library(laydi)
|
||||||
|
write.ftsv(matrix, file, ...)
|
||||||
|
|
||||||
}
|
}
|
||||||
\author{
|
\author{
|
||||||
Einar Ryeng <einarr@pvv.org>
|
Einar Ryeng <einarr@pvv.org>\cr
|
||||||
Arnar Flatberg <arnar.flatberg@gmail.com>
|
Arnar Flatberg <arnar.flatberg@gmail.com>
|
||||||
|
|
||||||
Maintainer: Einar Ryeng <einarr@pvv.org>
|
Maintainer: Einar Ryeng <einarr@pvv.org>
|
||||||
}
|
}
|
||||||
\references{
|
\references{
|
||||||
}
|
}
|
||||||
~~ Optionally other standard keywords, one per line, from file KEYWORDS in ~~
|
|
||||||
~~ the R documentation directory ~~
|
|
||||||
\keyword{ package }
|
\keyword{ package }
|
||||||
\seealso{
|
\seealso{
|
||||||
~~ Optional links to other man pages, e.g. ~~
|
% ~~ Optional links to other man pages, e.g. ~~
|
||||||
~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
|
% ~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
~~ simple examples of the most important functions ~~
|
library(laydi)
|
||||||
|
write.ftsv(randu, con="/tmp/randu.ftsv")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
\name{write.ftsv}
|
\name{write.ftsv}
|
||||||
\alias{write.ftsv}
|
\alias{write.ftsv}
|
||||||
%- Also NEED an '\alias' for EACH other topic documented here.
|
\title{write.ftsv}
|
||||||
\title{
|
|
||||||
%% ~~function to do ... ~~
|
|
||||||
}
|
|
||||||
\description{
|
\description{
|
||||||
Writes a matrix to a ftsv (laydi dataset) file. The matrix must have rownames
|
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
|
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}}, ~~~
|
%% ~~objects to See Also as \code{\link{help}}, ~~~
|
||||||
}
|
}
|
||||||
\examples{
|
\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
|
library(datasets)
|
||||||
function(data, con, name="unnamed_dataset", rowdim="rows", coldim="cols") {
|
write.ftsv(randu, "/tmp/randu.ftsv")
|
||||||
# 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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
% Add one or more standard keywords, see file 'KEYWORDS' in the
|
|
||||||
% R documentation directory.
|
\keyword{ IO }
|
||||||
\keyword{ ~kwd1 }
|
\keyword{ file }
|
||||||
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
|
|
||||||
|
|
Reference in New Issue