Added method for writing laydi selections.
This commit is contained in:
parent
98a9d581af
commit
1d94b46777
@ -27,4 +27,19 @@ write.ftsv <- function(data, con, name="unnamed_dataset", rowdim="rows", coldim=
|
||||
close(con)
|
||||
}
|
||||
|
||||
write.laydi.selection <- function(data, con) {
|
||||
# If con is a file name, open it
|
||||
opened.here = FALSE
|
||||
if (is.character(con)){
|
||||
con = file(con, "w")
|
||||
opened.here = TRUE
|
||||
}
|
||||
|
||||
writeLines(gsub("\\s", "_", data), con=con)
|
||||
|
||||
# If con was a string, close file now
|
||||
if (opened.here)
|
||||
close(con)
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@ LazyLoad: \tab yes\cr
|
||||
|
||||
library(laydi)
|
||||
write.ftsv(matrix, file, ...)
|
||||
write.laydi.selection(idlist, file)
|
||||
|
||||
}
|
||||
\author{
|
||||
@ -34,6 +35,4 @@ Maintainer: Einar Ryeng <einarr@pvv.org>
|
||||
% ~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
|
||||
}
|
||||
\examples{
|
||||
library(laydi)
|
||||
write.ftsv(randu, con="/tmp/randu.ftsv")
|
||||
}
|
||||
|
61
R/laydi/man/write.laydi.selection.Rd
Normal file
61
R/laydi/man/write.laydi.selection.Rd
Normal file
@ -0,0 +1,61 @@
|
||||
\name{write.laydi.selection}
|
||||
\alias{write.laydi.selection}
|
||||
\title{write.laydi.selection}
|
||||
\description{
|
||||
Writes a Laydi selection file from a list of identifiers. Identifiers are
|
||||
written one per line, with all whitespace characters substituted with
|
||||
underscores.
|
||||
}
|
||||
\usage{
|
||||
write.laydi.selection(data, con)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{
|
||||
A list of identifiers. All whitespace characters will be replaced wity
|
||||
underscores in the output. (Laydi requires unique identifiers along a
|
||||
dimension, and does not allow identifiers to contain spaces.) This method
|
||||
does not ensure that identifiers are unique.
|
||||
}
|
||||
\item{con}{
|
||||
Connection (or file name) to write the data to. If con is a character
|
||||
string, it will be treated as a file name, and a file by that name will be
|
||||
created, written to and closed. If con is an open connection (file descriptor),
|
||||
the file will remain open.
|
||||
}
|
||||
}
|
||||
|
||||
\details{
|
||||
%% ~~ If necessary, more details than the description above ~~
|
||||
}
|
||||
\value{
|
||||
%% ~Describe the value returned
|
||||
%% If it is a LIST, use
|
||||
%% \item{comp1 }{Description of 'comp1'}
|
||||
%% \item{comp2 }{Description of 'comp2'}
|
||||
%% ...
|
||||
}
|
||||
\references{
|
||||
Laydi and the laydi R package are not published in the litterature. Source code
|
||||
can be found at http://dev.pvv.ntnu.no/projects/laydi
|
||||
}
|
||||
\author{
|
||||
Einar Ryeng
|
||||
}
|
||||
\note{
|
||||
%% ~~further notes~~
|
||||
}
|
||||
|
||||
%% ~Make other sections like Warning with \section{Warning }{....} ~
|
||||
|
||||
\seealso{
|
||||
%% ~~objects to See Also as \code{\link{help}}, ~~~
|
||||
}
|
||||
\examples{
|
||||
|
||||
write.laydi.selection(c("sample1", "sample2", "sample3", "/tmp/selected_samples"))
|
||||
|
||||
}
|
||||
|
||||
\keyword{ IO }
|
||||
\keyword{ file }
|
||||
|
Reference in New Issue
Block a user