I want to rename all columns of my dataframe (expect id and t) by adding the prefix "le_". Firstly I turn the data frame from wide to long format and after specifying the columns ( named 1 - 27) I want to rename them as le_1 - le_27. Any suggestions on how to do this? I tried with rename but I got stuck.
df_long_le <- df_wide_le %>%
pivot_longer(cols = starts_with("le_"), names_to = c( "t", ".value"),
names_pattern = "le_(.*)_(.*)") %>%
rename(df_long_le[3:29] = "le_*[1-27]")
Thank you!
This is how the dataframe looks like enter image description here