Let's say I have a dataset with very weird names and I want to modify/replace a part of the string of the variable names, and add a logical sequence. The code below works pretty well, since it replace "nameverybig" by "var".
    library(tidyverse)
ds <- data.frame(identification = 1:10,
                 nameverybig_do_you_like_cookies = c(1:10), 
                 nameverybig_have_you_been_in_europe = c(1:10),
                 nameverybig_whats_your_gender = c(1:10))
    ds <- ds %>% 
      rename_all(.,~sub("nameverybig_*", 
                        paste("var"),
                        names(ds)))
But I'm struggling with the process of renaming the string and adding a logical sequence.
ds %>% names
dados <- ds %>% 
  rename_all(.,~sub("nameverybig_*", 
                    paste("var", 1:3),
                    names(ds)))
I would like to stay within the tidyverse framework. I've tried rename_all + contains and matches, and rename_at, but with no success. I based this code on other posts, such as this one and this one
This post has a reproducible code. Please let me know if I need to enhance the quality of the question.
Thank you.