gt
                                
                                
                                
                                    gt copied to clipboard
                            
                            
                            
                        Feature Request: `str_replace()`, `str_replace_all()` like renaming within `cols_label()` to apply across as many columns as applicable
I would like to see cols_label support multi-column renames using pattern matching and specified replacement strings for matches much like str_replace, str_replace_all.
If I had columns such as: c1_mean_2019-20, c1_mean_2020-21, I would like to be able to replace c1_mean_ with '', leaving  2019-20, 2020-21. This needs to happen IN the gt object.
Something like:
cols_label( contains('c1_mean_') = str_replace(contains('c1_mean_'),'c1_mean_', '') )
Looking at cols_label this functionality does not appear to exist.
This is a good idea! Could work in the form of
cols_label(contains("...") = ~ fn(.))
So that any string manipulation functions would work. We'd have to also ensure that helpers such as md(), html(), etc., continue to work in this form
cols_label(contains("...") = md(~ fn(.)))
and this
cols_label(contains("...") = ~ md(fn(.)))
                                    
                                    
                                    
                                
Fixed by #1158.