Yomi.blaze93
Yomi.blaze93

Reputation: 425

How to pass database query to strings using dplyr filter function

I'm trying to pass database query to strings using dplyr filter functions

here is the code

main<-tbl(portal, "account")%>%
  filter( dates >= "1640991600" & dates <= "1641077999")%>%
  collect()%>%
  as.character()

but it's not working, any help would be welcome

Upvotes: 0

Views: 154

Answers (1)

danlooo
danlooo

Reputation: 10627

collect() will return an object of class data.frame which is a table that can not be converted into a character vector implicitly. Instead of as.character(), you can do write_csv("query_result.csv") to save the received table into a file or pull(col1) %>% as.character() to get a character vector of the column named col1.

Upvotes: 1

Related Questions