I recently moved from Stata to R and I'm getting more and more familiar with tidyverse. In Stata I usually relied on for-loops to operate similar calculations, only differing by the referring variables, that can be identified by a variable's suffix. Consider the following example:
newvar_a = oldvar_a + constant
...
newvar_h = oldvar_h + constant
Usually the calculations are a little bit more complex, but basically they always contain one or more variables that share the same suffix and another group plus something. I use these calculations a lot of times. Is there an easy and efficient equivalent in R? I tried solving my problem with functions and loops but didn't get anywhere close. Searching unfortunately didn't show up anything. I'd prefer a solution relying on tidyverse as I'm getting familiar with tidyverse and especially the "apply"-functions seem quite complex to me, but if there is no simple solution with tidyverse, I gladly accept any solution.
Thanks a lot!