Reading Multiple Objects from Files (zipfR)
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
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")
## 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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.