I try to load files in different categories according to theis file name. Till now I always used
list<-dir(pattern=".gle$")
to get all gle-files. Now I want to load the populations bg, campo & pca seperately and I am searching for a wildcard which can be used in the middle of filenames, which are e.g.
0KK_bg_SunAdj.gle
0LC_campo_SunAdj.gle
0KR_pca_SunAdj_corr.gle
I thought of something like
list<-dir(pattern=glob2rx("*something*bg*something*.gle$"))
but I tried all the examples in the ?glob2rx help file and did not succeed.
I’m sure it is possible (I mean; it’s R…) but i cannot figure it out…
Thanks!
How about
But these might pick up other files in the directory. If not, then @RomanLuštrik probably hit the nail on the head in the comment above. EDIT: Actually, @RomanLuštrik ‘s comment would pick up non-.gle files. So the above code would be more appropriate.