r - Creating a list for search query from column using dbhydroR package -
i trying create list can copy search query function data.frame column. output below code in format of :
‘c-484,''f-409,''s-18a,''g-850,''pb-632,'...etc.
but need read
'c-484','f-409','s-18a','g-850','pb-632', ...etc.
there 1,974 variables. how can switch placement of last quote around each variable comma?
inactivestations <- read.csv("inactive_wells.csv",header=true) #subset , make data.frame station (station names) allstations_inactive <- inactivestations['station'] #not separated in way can copied query list(allstations_inactive$station) #separated commas , has quotes around each variable commas inside quotes test<-paste0(allstations_inactive$station, collapse="''",sep=",") ##separated commas , has quotes around each variable commas inside quotes test1<-paste0(allstations_inactive$station, sep=",",collapse="''")
thank in advance
this approach works:
input <- c("c-484", "f-409", "s-18a", "g-850", "pb-632") output <- paste0("'", input, "'", collapse = ",") # cat(output) # 'c-484','f-409','s-18a','g-850','pb-632'
so in specific case becomes:
test1 <- paste0("'", allstations_inactive$station, "'", collapse = ",")
Comments
Post a Comment