[R] inner join sqldf

Newbie19_02 nvanzuydam at gmail.com
Mon Mar 15 15:39:22 CET 2010


Dear Gabor,

require(sqldf)

file(description="http://n4.nabble.com/file/n1593282/test_sql_psd.txt",
open="")
file(description="http://n4.nabble.com/file/n1593282/test_sql_tsf.txt",
open="")

test_sql_psd <- 
read.table(file="http://n4.nabble.com/file/n1593282/test_sql_psd.txt",
header=TRUE, sep="\t", dec=".", na.strings="NA",
check.names=TRUE, quote= "\"'")


test_sql_tsf
<-read.table("http://n4.nabble.com/file/n1593282/test_sql_tsf.txt" ,
header=TRUE, sep="\t", dec=".", na.strings="NA", check.names=TRUE, quote=
"\"'")




test_sql_innerjoin <- sqldf("select * from test_sql_psd inner join
test_sql_tsf
on test_sql_psd.prochi=test_sql_tsf.prochi")

Please note that in my previous email I said that I had used union and it
had worked.  In fact it did not.

test_sql_union<-sqldf("select * from test_sql_tsf union select * from
test_sql_psd") 
did not work because of the following error:  Error in
sqliteExecStatement(con, statement, bind.data) : 
  RS-DBI driver: (error in statement: SELECTs to the left and right of UNION
do not have the same number of result columns)


Please let me know if this works otherwise I'll amend the code again.

Thanks,
natalie
-- 
View this message in context: http://n4.nabble.com/inner-join-sqldf-tp1593282p1593451.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list