如何使用R和dplyr从红移中检索超过100000行

如何使用R和dplyr从红移中检索超过100000行,r,dplyr,amazon-redshift,rpostgresql,R,Dplyr,Amazon Redshift,Rpostgresql,我正在分析红移数据库中的数据,在R中使用每个dplyr的连接—这是有效的: my_db<-src_postgres(host='my-cluster-blahblah.redshift.amazonaws.com', port='5439', dbname='dev',user='me', password='mypw') mytable <- tbl(my_db, "mytable") viewstation<-mytable %>% filter(stati

我正在分析红移数据库中的数据,在R中使用每个dplyr的连接—这是有效的:

my_db<-src_postgres(host='my-cluster-blahblah.redshift.amazonaws.com', port='5439', dbname='dev',user='me', password='mypw')
mytable <- tbl(my_db, "mytable")

viewstation<-mytable %>%
    filter(stationname=="something") 
我应该在哪里设置n?

而不是使用

thisdata<-data.frame(viewstation)
此数据适用于仍在使用dplyr 0.5的用户(如我)。
参数
n
collect
功能的一部分

my_db<-src_postgres(host='my-cluster-blahblah.redshift.amazonaws.com', port='5439', dbname='dev',user='me', password='mypw')
mytable <- tbl(my_db, "mytable") %>% collect(n = Inf)

my_dbNote,我确实希望将子集设置为少于100000个点,但我不能这样做:thisdata更好的做法是使用SELECT查询中的WHERE子句将子集设置为红移。它将防止不必要的数据通过网络传输,并填满您机器的内存。但我想要所有这些数据:)我想要所有这些数十万点。随机选择以降低数字仅是OK次佳。如果可能的话,我宁愿呆在dplyr中——这对于它工作的用例来说非常简单……我知道可以直接在rpostgresql管理的查询中设置n——它是“fetch”命令的一个参数。但是我怎样才能从dplyr得到它呢?哦,phiver,我认为它有效。然后是
thisdata\u df
thisdata<-data.frame(viewstation)
thisdata <- collect(viewstation)
my_db<-src_postgres(host='my-cluster-blahblah.redshift.amazonaws.com', port='5439', dbname='dev',user='me', password='mypw')
mytable <- tbl(my_db, "mytable") %>% collect(n = Inf)