Let's say I have three files containing:
File 1:
x y z
1 4 6
File 2:
x y z
2 5 9
File 3:
x y z
5 4 8
My goal is to import the data from a file only if in this file y == 4
(so here I would want to import files 1 and 3).
Is there a way to do that with functional programming? The only solution I can think of currently is to loop through all the files, check if data[[2, 2]] == 4
, and append this data to a list if true. Is there a better way to do that?
And if I have to loop, is it better to import all the files as lists and then discard the lists that do not match y == 4
? Or is it better to import only the files matching y == 4
in the first place?
y==4
without importing the files somehow ? $\endgroup$ – b.gates.you.know.what Jan 8 '13 at 10:48