0

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

1
  • 1
    Hi user16087142, you need to provide us at least a bit of data or the error message. Commented Mar 16, 2022 at 10:03

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you danlooo What I did was to save it as you have suggested in your answer("query_result.csv"), then read it back using read.csv and set the colClasses to "character"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.