I have multiple csv files for which I want to access second column for every file and do a regex which will remove all strings after ";". this Pattern is same for all the files. I have referred this In R, how to get an object's name after it is sent to a function? This is a sample of my file
ID POLL
1 1,2:ksd ksj
2 3:jj
3 6:ok0j
This is what I have tried
setwd("D:/Data/STN")
temp = list.files(pattern="*.csv")
for(i in 1:length(temp)){
DF1=read.csv(temp[i])
col2=colnames(DF1)[2]
assign(paste(DF1,"$"),col2)
DF1$col2 = gsub(":.*","",DF1$col2)
In temp I have all names of all files, I tried with assign but no output. Thanks in advance