On Thu, 1 May 2003, Adam Tee wrote:
Hi,
I'm new to R and have looked at the mail archives and not
seen a solution to my problem.
I have a set of data files with filenames in the following form
haydn1stmvt.jtf.sim0.142292.et.dist, where the latter half
changes, after the jtf.
What I am trying to do is process the set of these files using
R's batch mode. using the following :
library(mva)
mdsdata <- read.table(file)
cm <- cmdscale(mdsdata)
x <- cm[,1]
y <- -cm[,2]
postscript("file.eps", height=5, width=5)
plot(x,y,type="n", main="classical MDS")
text(x,y,names(mdsdata))
dev.off()
I want the variable file to contain the relevant file name with
having to input it manually for each file. Is there an easy solution to
this ??
files <- list.files(pattern="^haydn1stmvt.jtf") and then a for loop over `files' would appear to do what I think (but am unsure) you want.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595