Hi Anne, It would be helpful to include at least part of behavioral_df for people to understand the issue better. Please do the following in R and post the output.
dput( head( behavioral_df) ) Also, set your email to plain text as HTML is stripped from emails on this list. Best, Eric On Tue, Oct 5, 2021 at 7:15 PM Anne Zach <anne.zach.z...@gmail.com> wrote: > Dear R users, > > I have a dataframe that contains several variables, among which 105 > correspond to scores on certain trials. Unfortunately, when I imported this > dataframe into R, I realised that the variable names corresponding to each > trial begin with digits, which violates R naming conventions. > > I am trying to relabel these variables by adding a 'v' as a prefix to each > of them, I'd like to use tidyverse, but I am struggling with this process > of renaming. When I run this chunk of code, no error occurs but my > variables are not renamed. I'm fairly new to R and I can't understand what > I'm doing wrong. > > ```{r} > > behavioral_df <- behavioral_df %>% rename_with(.fn = ~paste0("v"), > starts_with('^\\d')) > > ``` > > I appreciate if you can help. > > Best, > Anne > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.