Hello Rui, it's very helpful. Thank you, Kai On Wednesday, July 14, 2021, 10:07:57 AM PDT, Rui Barradas <ruipbarra...@sapo.pt> wrote: Hello,
Just before for(j in 1:nrow(ora)) include the following code line (I have removed the underscore): sdif <- vector("list", length = nrow(ora)) In the loop: sdif[[j]] <- sqldf(etc) Also, once again, why noquote? It's better to form file names with file.path: rdcsv <- file.path("w:/project/_Joe.B/Oracle/data", mycsv) Hope this helps, Rui Barradas Às 16:55 de 14/07/2021, Kai Yang via R-help escreveu: > Hello List, > I wrote a script below to compare the difference of data frames structure > (and will do something else). First of all I save the file list in a data > frame ora, then I use for loop to 1. load the data from two resource, 2. > generate data structure into two data frames, 3.do the comparesion of the two > data frames of data structure and put it into a data frame, 4. remove the > useless data frames for next loop > for (j in 1:nrow(ora)) > { > mycol <- ora[j,"fname"] > #--------------------work on csv------------ > mycsv <- paste0(mycol,".csv") > rdcsv <- noquote(paste0("w:/project/_Joe.B/Oracle/data/", mycsv)) > rr <- read.csv(rdcsv) > > #--------------------work on SS ------------ > myss <- paste0("gemd.", mycol) > rdss <- paste0('select * from ',myss) > ss <- dbGetQuery(con, rdss) > > #--------------------compare DF structure ------------ > str_rr <- as.data.frame(summary.default(rr)) > str_ss <- as.data.frame(summary.default(ss)) > > > sdif_[j] <- sqldf('select * from str_rr except select * from str_ss') > > #---------remove data frame from memory-------------- > > rm(rr) > rm(ss) > rm(str_rr) > rm(str_ss) > } > In the step 3, I want to use ora$fname in the loop to assign a data frame > name. So, I will look the output later. But sdif_[j] doesn't work for this. > Can someone help me to fix this part? > Thanks, > Kai > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Este e-mail foi verificado em termos de vírus pelo software antivírus Avast. https://www.avast.com/antivirus [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.