如何從dplyr中的任何(常規)SQL查詢中接收完整結果?這是一個玩具示例,其中SQL查詢只是返回完整的表格。more dplyr中的500結果行泛型SQL
library("plyr")
library("dplyr")
## connect to a database
hflights_sqlite <- tbl(hflights_sqlite(), "hflights")
my_con <- src_sqlite(hflights_sqlite$src$path)
## here is the problem
tbl(my_con, sql("SELECT * FROM hflights"))
## ...
## Warning message:
## Only first 500 results retrieved. Use n = -1 to retrieve all.
tbl(my_con, sql("SELECT * FROM hflights"), n=-1)
## ...
## Warning message:
## Only first 500 results retrieved. Use n = -1 to retrieve all.
(這是不是一個關於這裏使用,當然,具體的簡單的SQL問題)
我對'src_sqlite'不熟悉。但是,前兩行不適合我。我嘗試了以下'my_db < - src_sqlite(path = tempfile(),create = TRUE); my_db < - copy_to(my_db,iris)'我擁有整個虹膜數據。 – jazzurro 2014-10-03 17:17:50
請參閱'?collect'。 – hadley 2014-10-03 21:01:39
@hadley謝謝。但你能在這裏更明確嗎?即使在閱讀'collect'之後,我也不清楚如何使用'collect'來進行一般的SQL查詢。顯然'收集(tbl(my_con,sql(「選擇*從hflights」)))'是沒有解決方案。 – Andreas 2014-10-03 21:08:54