I am trying to create a list that I can copy into a search query for a function from a data.frame column. My output from the below code is in the format of :
‘C-484,''F-409,''S-18A,''G-850,''PB-632,'...etc.
But I need it to read
'C-484','F-409','S-18A','G-850','PB-632', ...etc.
There are 1,974 variables. How can I switch the placement of the last quote around each variable with the comma?
inactivestations <- read.csv("INACTIVE_WELLS.csv",header=TRUE)
#subset and make data.frame for only STATION (station names)
allstations_inactive <- inactivestations['STATION']
#not separated in a way that can be copied into a query
list(allstations_inactive$STATION)
#separated by commas and has quotes around each variable but commas inside quotes
test<-paste0(allstations_inactive$STATION, collapse="''",sep=",")
##separated by commas and has quotes around each variable but commas inside quotes
test1<-paste0(allstations_inactive$STATION, sep=",",collapse="''")
Thank you in advance