I work mostly on data.table package in R. But everytime i query something from database. I have to use a setDT() command on it.
Is there any package or anyway I can directly get a data.table from database.
Any help any suggestions would do?
I work mostly on data.table package in R. But everytime i query something from database. I have to use a setDT() command on it.
Is there any package or anyway I can directly get a data.table from database.
Any help any suggestions would do?
Is that setDT()
in a workflow that already uses rqdatatable?
Can we Query a database using rqdatatable. I read their website before posting it here. and It seems like they are trying to query a datatable from R not a database.
If you have any simple example I would highly appreciate it.
You could write a wrapper function. For example, if you've been using dbGetQuery()
from the DBI
package:
dbGetQueryDT <- function(conn, statement, ...) {
res <- DBI::dbGetQuery(conn, statement, ...)
setDT(res)
res
}
Then just find/replace all instances of dbGetQuery
with dbGetQueryDT
.
Ah, I misunderstood. I think rquery is the more general package, and rquerydatatable is, as you said, for in-memory data.tables
Thanks for answering my question. But I was looking for a direct way to get a data.table. Just wanted to know if that is possible.
When you are querying medium dataframe then setDT() is not efficient method on each query
Yes thanks for verifying my statement. I had doubts too...
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.