Hi,
I've got the following code which seems to work fine for a single
file if I specify the file name explicitly in the code. What I need to
do is run it on all the files in the directory tested and augment the
data frame I'm building to have more results columns.How can I do
that?
Here's
Quick and dirty answer:
Try ?paste in conjunction with a for loop which iterates over
i:length(Files), and you can paste i onto the end of your filename, then
add the data to cd=list(), cd[i], then unlist the data or
as.data.frame(cd).
I'm sure there are more elegant alternatives.
Ross
--
Hi Mark,
If you have a function that, for a given file name, returns the data
in the way you want, then you can use 'dir' or 'paste' to generate a
list of names, which you can read in in one go with apply:
my_read - function(filename)
{
...
}
filenames - dir(directory,pattern)
filenames -
3 matches
Mail list logo