I have a set of txt files on a folder. I have already listed them on R and added them as separate datasets
file.list <- list.files(path = folder, ignore.case= T, pattern='txt', full.names = TRUE)
file.list = c("test/2021-04-22_1_7787551954_NI_800240882_EPS046_13_IP_2021-04.TXT",
"test/2021-04-23_1_20313433_NI_800102838_EPS046_86_IP_2021-05.TXT",
"test/2021-04-28_1_7787988732_NI_800112806_EPS046_13_IP_2021-05.TXT",
"test/2021-04-30_1_7788094522_NI_900391901_EPS046_19_IP_2021-05.TXT",
"test/2021-04-30_1_9419310550_NI_890200500_EPS046_84_IP_2021-05.TXT"
)
for (i in 1:length(file.list)) assign(file.list[i], read_csv(file.list[i],col_names = FALSE,locale = readr::locale(encoding = "latin1")))
now i need to recursively apply a function to each newly created dataframe file from that file list and then saving them back again to a different folder, while maintaining original filenames.
this is the function that i need to apply on each dataframe
df.test$X1 <- sub("^(.{366}).{9}$", "\\1", df.test$X1, perl = TRUE)
will appreciate your advise