File: read_datasets.Rd

package info (click to toggle)
r-cran-eaf 2.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,028 kB
  • sloc: ansic: 7,281; perl: 848; makefile: 73; sh: 43; python: 27
file content (68 lines) | stat: -rw-r--r-- 2,357 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read_datasets.R
\name{read_datasets}
\alias{read_datasets}
\alias{read.data.sets}
\title{Read several data sets}
\usage{
read_datasets(file, col_names, text)

read.data.sets(file, col.names)
}
\arguments{
\item{file}{(\code{character()}) \cr Filename that contains the data.  Each row
of the table appears as one line of the file.  If it does not contain an
\emph{absolute} path, the file name is \emph{relative} to the current
working directory, \code{\link[base]{getwd}()}.  Tilde-expansion is
performed where supported.  Files compressed with \code{xz} are supported.}

\item{col_names, col.names}{Vector of optional names for the variables.  The
default is to use \samp{"V"} followed by the column number.}

\item{text}{(\code{character()}) \cr If \code{file} is not supplied and this is,
then data are read from the value of \code{text} via a text connection.
Notice that a literal string can be used to include (small) data sets
within R code.}
}
\value{
(\code{matrix()}) containing a representation of the
data in the file. An extra column \code{set} is added to indicate to
which set each row belongs.
}
\description{
Reads a text file in table format and creates a matrix from it. The file
may contain several sets, separated by empty lines. Lines starting by
\code{'#'} are considered comments and treated as empty lines. The function
adds an additional column \code{set} to indicate to which set each row
belongs.
}
\note{
There are several examples of data sets in
\code{system.file(package="eaf","extdata")}.

\code{read.data.sets()} is a deprecated alias. It will be removed in the next
major release.
}
\section{Warning}{

A known limitation is that the input file must use newline characters
native to the host system, otherwise they will be, possibly silently,
misinterpreted. In GNU/Linux the program \code{dos2unix} may be used
to fix newline characters.
}

\examples{
extdata_path <- system.file(package="eaf","extdata")
A1 <- read_datasets(file.path(extdata_path,"ALG_1_dat.xz"))
str(A1)

read_datasets(text="1 2\n3 4\n\n5 6\n7 8\n", col_names=c("obj1", "obj2"))

}
\seealso{
\code{\link[utils]{read.table}}, \code{\link[=eafplot]{eafplot()}}, \code{\link[=eafdiffplot]{eafdiffplot()}}
}
\author{
Manuel \enc{López-Ibáñez}{Lopez-Ibanez}
}
\keyword{file}