Description Usage Arguments Format Value See Also Examples
read.multiple.objects
constructs a list of spc
,
vgc
or tfl
objects from a set of input
text files in the specified directory
NB: This function is intended for users that want to run
advanced experiments (e.g., handling hundreds of spectra generated in
multiple randomizations experiments). For the standard
one-object-at-a-time reading functionality, look at the documentation
of read.spc
, read.vgc
and
read.tfl
1 | read.multiple.objects(directory, prefix, class=c("spc", "vgc", "tfl"))
|
directory |
character string specifying the directory where the target input files reside (absolute path, or path relative to current working directory) |
prefix |
character string specifying prefix that must be shared by all target input file names |
class |
one of |
read.multiple.objects
reads in all files matching the pattern
prefix.id.class
from the specified directory, where the
prefix
and class
strings are passed as arguments, and
id
is an arbitrary string that is used as index of the
corresponding object in the output list
read.multiple.objects
calls the read
function
corresponding to the class
argument. Thus, the input files must
respect the formatting conventions of the relevant reading functions
(see documentation of read.spc
, read.vgc
and read.tfl
)
read.multiple.objects
returns a list of objects of the
specified class; each object is indexed with the id extracted from the
corresponding file name (see section "Format")
See the spc
, vgc
and tfl
manpages for details on the corresponding objects;
read.spc
, read.vgc
and
read.tfl
for the single-file reading functions and input
format details
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 | ## Not run:
## These are just illustrative examples. Users should fill in their
## own files instead of the dummy names used here.
## suppose that the current working directory contains
## 100 spc files named: rand.1.spc, rand.2.spc, ...,
## rand.100.spc
## read the files in:
spc.list <- read.multiple.objects(".","rand","spc")
## you can access each spc using the id extracted from
## the file name, e.g.:
summary(spc.list[["1"]])
## more usefully, you might want to iterate over the
## whole list, e.g., to calculate mean V:
mean(sapply(spc.list,V))
## notice that ids are arbitrary strings
## e.g., suppose that directory /home/me/animals
## contains sounds.dog.vgc and sounds.elephant.vgc
## we read the vgcs in:
vgc.list <- read.multiple.objects("/home/me/animals","sounds","vgc")
## accessing the elephant vgc:
V(vgc.list[["elephant"]])
## of course, tfl-reading works in the same way (assuming
## that the animals directory also contains some tfl files):
tfl.list <- read.multiple.objects("/home/me/animals","sounds","tfl")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.