[R] skip reading a file.

From: Alaios <alaios_at_yahoo.com>
Date: Tue, 24 May 2011 03:00:57 -0700 (PDT)


Dear all,
I would like to do read a bunch of files that have the following format

file_i_j
examples:

file_1_1
file_1_2
file_1_3
file_2_1
file_2_2
file_3_1
file_3_2
file_3_3
file_3_4
file_4_1
file_4_2

The integer i goes from 1 to 100
and the integer j starts from 1 and stops somewhere between 1 and 100, which I do not know in advance

Usually I would be able to solve this by having a nested loop

(algorithmic syntax below, not sure if is R okay) for i in (c(1:100))
  for j in (c(1:100))
    store[i,j]<- read file_i_j
   end
end

the problem with that is that R will halt when j take a value that refers to a non existing value. Thus I want to have a good way to break the nested loop and continue with the outer one. How I can do that?

Best Regards
Alex



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 24 May 2011 - 10:10:08 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 May 2011 - 11:40:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive