mercredi 15 novembre 2017

How can I build regular expression in R?

I have the following dataframe:

aa123 aa123.1 aa456 aa456.1
1     2       3     4

I want to take only the columns that match a pattern: "aa[numbers].1". In other words to extract only the columns that end with ".1".

I have tried to use regular expression pattern for grep and dplyr select/filter + ends_with() with pattern = ".1"

But nothing seems to work, please advise me how can I build such pattern and point me to a guide how in the future to build the pattern I need.

Aucun commentaire:

Enregistrer un commentaire