Suppose I have 3 files named
JohnDoe, PeterGynn, JolieHope
in a folder and now I would like to change the filename from matching values of a data frame df1.
df1 <- structure(list(employee = c("John Doe", "Peter Gynn", "Jolie Hope"), salary = c(21000, 23400, 26800)), row.names = c(NA, -3L), class = c("data.table", "data.frame"))
so the final file name would be
21000, 23400, 26800
Basically, I want to change the file name from the matching employee column to the salary column. I can do it in bash
find . -type f -name "*.txt" -printf "/%P\n" | while read FILE ; do DIR=$(dirname "$FILE" );\
but donot know in r
Any help? Thanks in advance