[R] Problem

Ott Toomet siim at obs.ee
Fri May 10 08:46:38 CEST 2002


On Thu, 9 May 2002, Ambrosini Alessandro wrote:
  |for (filename in all.file.names){
  |  m1<-read.table(filename,fill=TRUE,header=FALSE)
  |  m1<-m1[m1[,1]%in%qvals,]

Cannot you simly check here if there is any rows left in m1?  E.g. write
something like

if(rows(df1) == 0) next

  |  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]))
  |  unione[[filename]]<-m1c

Perhaps it helps.


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