I have multiple data frames that I read from a bunch of txt files in a folder using the easycsv package. Now I want to merge all the data frames together into one, but first I need to add a unique identifier variable to each data frame. Each data frame contains data from one participant. The number of rows for each data frame varies between participants. The participant number is 2 to 3 digits long and always directly follows the characters "VP" in the file name. How can I extract the participant number from the file name and add it as a new column to the data frames, preferrably in one go? I would really appreciate any help in this issue!
Thanks in advance!