I have a question that may be very simple, but I still haven't managed to solve it.
I have a data.frame with multiple columns, with the following structure in the column names: NDVI_20180506, NDVI_20180526, NDVI_20180917, NDVI_20180929, NDVI_20181008, NDVI_20181126 ...
I would like to create a new column every time a similar pattern appears in the column name ("NDVI_201805
").
For example: NDVI_May
(column name) and that the column contains the average of the columns NDVI_20180506
, NDVI_20180526
.