title: algorithm/code in R to find pattern from any position in a string
body: <p>I want to find the pattern from any position in any given string such that the pattern repeats for a threshold number of times at least. 
  For example for the string "a0cc0vaaaabaaaabaaaabaa00bvw" the pattern should come out to be "aaaab". Another example: for the string "ff00f0f0f0f0f0f0f0f0000" the pattern should be "0f". 
  In both cases threshold has been taken as 3 i.e. the pattern should be repeated for at least 3 times. </p>
  
  <p>If someone can suggest an optimized method in R for finding a solution to this problem, please do share with me. Currently I am achieving this by using 3 nested loops, and it's taking a lot of time.</p>
  
  <p>Thanks!  </p>