I have a list of files, which was created using list.files:
filesxx<-list.files(pattern="0-4000")
obtainig a list like the following one:
[1] "Alta Guajira Coord & elevation TS 0-4000.txt" "Baja Guajira Coord & elevation TS 0-4000.txt"
[3] "Bajo Meta Coord & elevation TS 0-4000.txt" "Rio Arauca Coord & elevation TS 0-4000.txt"
[5] "Rio Catatubo Coord & elevation TS 0-4000.txt" "Rio Cesar Coord & elevation TS 0-4000.txt"
[7] "Rio Sogamoso Coord & elevation TS 0-4000.txt" "Rio Tomo Coord & elevation TS 0-4000.txt"
[9] "Sabana de Bogota Coord & elevation TS 0-4000.txt" "Total Area Coord & elevation TS 0-4000.txt"
and from this list I want create a loop that will select one of this files depending on the loop variable (a) wich will be a pattern in the name, for example the variable (a) will be: "Alta Guajira" and in the next cycle "Rio Tomo".. etc
How can I do this, how to chose a file with a pattern from a list of files already made?
I think the function Shopt
is more to exclude patterns and maybe the function find
could work but after looking for some similar case I havent found the answer.