0

I have a database with 19 different tables.

dbListTables(con)
[1] "Sample_86103"     "Sample_87024"     "Sample_87082"     "Sample_88156"     "Sample_89090"     "Sample_90061"     "Sample_90186"    
 [8] "Sample_90204"     "Sample_91023"     "Sample_91_0235_2" "Sample_92178"     "Sample_93146"     "Sample_93253"     "Sample_94049"    
[15] "Sample_94152"     "Sample_94184"     "Sample_94286"     "Sample_96034"     "Sample_96102

I just need to use a FULLJOIN command on each table, similar to rbind in R.

Since I am a novice in SQL language, I have tried created the data.frame first by rbinding each of the Samples together, and finally write a database.

However, this takes up too much memory, and crashes my R session. So it is now necessary for me to use SQL database creation.

So using R, how can I join the created tables from the list above?

zx8754
  • 52,746
  • 12
  • 114
  • 209
sophie-germain
  • 911
  • 4
  • 10
  • 22
  • the reason I am struggling is because the questions posted here, are using SQL, whereas I am using RSQLite, and trying to use SQL from R. – sophie-germain Jun 23 '14 at 19:52
  • Can you just use sql query and make full join with plain sql? – jezzarax Jun 23 '14 at 20:25
  • that sounds like a good idea, but I am not sure how to do that. by using plain SQL you mean using SQL outside of R? which software should I use SQL to use full join? sorry if this is a nuub question. – sophie-germain Jun 23 '14 at 22:27
  • If you are using RSQLite, you can just make sql queries from R code (check http://www.r-bloggers.com/r-and-sqlite-part-1/ for example). So all you need is open a connection and make a query (something like sqldf("select a.*, b.* from table1 a join table2 b on a.key=b.fk", dbname = "db.sqlite")). – jezzarax Jun 24 '14 at 07:56
  • 1
    Use `DBI::dbWriteTable(append = TRUE)` to write each data frame to the same table, without having to load them all in memory at once – hadley Mar 14 '15 at 11:26

0 Answers0