Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Get all the files and then use <code>grep</code> to find the <code>noe</code> ones and subset them out:</p> <pre><code>&gt; all [1] "Name_Surname_123425_xy.xls" "Name_Surname_1234445_xy.xls" [3] "Name_Surname_12345_noe_xy.xls" "Name_Surname_12345_xy.xls" [5] "Name_Surname_13245_noe_xy.xls" &gt; all[grep("noe_xy.xls",all,invert=TRUE)] [1] "Name_Surname_123425_xy.xls" "Name_Surname_1234445_xy.xls" [3] "Name_Surname_12345_xy.xls" </code></pre> <p>always make sure you check the edge cases where all or none of the files match:</p> <pre><code>&gt; all[grep("xls",all,invert=TRUE)] character(0) &gt; all[grep("fnord",all,invert=TRUE)] [1] "Name_Surname_123425_xy.xls" "Name_Surname_1234445_xy.xls" [3] "Name_Surname_12345_noe_xy.xls" "Name_Surname_12345_xy.xls" [5] "Name_Surname_13245_noe_xy.xls" </code></pre> <p>Using grep with a negative index works except in these edge cases:</p> <pre><code>&gt; all [1] "Name_Surname_123425_xy.xls" "Name_Surname_1234445_xy.xls" [3] "Name_Surname_12345_noe_xy.xls" "Name_Surname_12345_xy.xls" [5] "Name_Surname_13245_noe_xy.xls" &gt; all[-grep("noe_xy.xls",all)] # strip out the noe_xy.xls files [1] "Name_Surname_123425_xy.xls" "Name_Surname_1234445_xy.xls" [3] "Name_Surname_12345_xy.xls" # works. Now strip out any xls files (should leave nothing) &gt; all[-grep("xls",all)] character(0) # yup, that works too. Now strip out 'fnord' files, shouldn't remove anything: &gt; all[-grep("fnord",all)] character(0) </code></pre> <p>Epic fail! Reason is left as an exercise to the reader.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload