Home > database >  How to pass database query to strings using dplyr filter function
How to pass database query to strings using dplyr filter function

Time:03-16

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

CodePudding user response:

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.

  • Related