vendredi 29 novembre 2019

Extracting numbers from a list based on the pattern using R

I am new in R, and i have small task but in same time is complected :(

Simply i have to create a list of number starting from (0000001) to (9999999) so, its seven digits number.

Then i have to extract any numbers that have the following digits pattern, and group them in different list as following:

  • Group A: (7 unique), where the number contains at least 7 unique numbers. (eg. 3896214)

  • Group C: ( 5 unique), where the number contains only with 5 unique numbers. (eg. 3816211)

  • Group C-1: ( 3 solid ) where the number contains at least 5 unique numbers but having triple solid digits e.g. 3816222. Note: this can take different form for example; (????xxx,??xxx??, ?xxx???, xxx????). Each form should be classified into separate list

I tried to use the grep codes but its not the appropriate way as this takes a lots of time and write a grep for each numbers out from 0-9 and so on.

please advice and suggest

Thank you,

Aucun commentaire:

Enregistrer un commentaire