[R] Problem

Tomei Lodino lodinoto at tin.it
Wed May 8 19:14:27 CEST 2002


Hi! This is the situation.
I have these commands. I have not to change anything in these lines but I
write them to make you understand the situation.

m1<-read.table("data",fill=TRUE,header=FALSE)
m2<-read.table("query.txt)
qvals<-levels(m2[[3]])
m1<-m1[m1[,1]%in%qvals,]
relnodes<-apply(m1,1,function(x)sum(x%in%qvals))
m1<-m1[relnodes>1,]
m1b<-as.list(as.data.frame(t(as.matrix(m1))))
m1c<-lapply(m1b,function(x)as.character(x[x%in%qvals]))

These lines import the external file "data", they make some things and give
me a output.
Now my problem is that  I have more or less 100 files. Everytime I take a
file, I call it m1 and I go on. When I obtain an output, a write
unione<-(unione,m1c) to update the output given before. (before starting the
first time I do unione<-NULL)
Now,  I want to know if there is some commands that repeat all the lines
written before, taking one by one all the 100 files that I have to use.
Maybe I can use the "for" command, but in which way?
Summarizing I have to do 100 times the lines written before, changing
everytime the name of the external file.
All the files are in the same directory. The file in m2 is the same for all
the iterations and so I have not to change it.
The names of the files are "dataa","datab","datac",...
Thank you very much.
Linda


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list