An R package to implement the data table back-end for 'dplyr'.
Questions tagged [dtplyr]
45 questions
1
vote
1 answer
Why does using bind_rows don't run in show_query()
How to get the final query in data.table format?
if not possible:
how to rewrite the query from dplyr to data.table ?
library(data.table)
library(dplyr)
library(dtplyr)
#Data
dt = structure(list(Year = c(2015L, 2016L, 2017L, 2015L, 2016L,…

HerClau
- 161
- 2
- 15
1
vote
0 answers
Read parquet partitioned file with dtplyr (lazy evalution) - R
I have those parquet files partitioned, so in multiple files.
I can read them with
df_test <- arrow::open_dataset('/path/topic.parquet',
partitioning=c("id"))
Since I have to do a lot of transformation before really…

Ragnar
- 2,550
- 6
- 36
- 70
1
vote
1 answer
R: Getting env_get_list error when trying to apply lazy_dt in order to use dtplyr
I'm trying to create a dashboard in R Shiny. As part of this dashboard, I have a very large dataset which has a column added reactively and in turn three reactive subsets of this dataset are produced by filtering on different dates.
So far, I have…

Wolff
- 1,051
- 3
- 18
- 31
1
vote
0 answers
What is the best way to use dplyr/dtplyr to make complex updates to a data.table
We have written a package to analyse a large number of events in relation to time windows.
To do the analysis we need to establish a number of attributes of the windows and cross-references
between them.
This has been done using data.table in its…

sch56
- 361
- 1
- 11
1
vote
1 answer
How to apply dtplyr with SQL Server database
I am trying to apply dtplyr to a SQL Server database.
I succeeded in applying dplyr as shown below, but I don't know how to apply dtplyr
How can I do this?
library(odbc)
library(DBI)
library(tidyverse)
library(dtplyr)
library(dbplyr)
con <-…

Wookeun Lee
- 463
- 1
- 6
- 18
1
vote
0 answers
setDT instead of as.data.table for piping with dplyr?
I've noted that dtplyr (released this January 1.0.1) uses as.data.table to bring the variable back to data.table type: https://dtplyr.tidyverse.org/articles/translation.html
I'm a big fan and user of data.table and use it pipeline with dplyr for…

IVIM
- 2,167
- 1
- 15
- 41
1
vote
2 answers
Updating column values based on previous values (once treated always treated)
I am wondering if there was a much faster way using data.table/dplyr to replace values based on previous values by group.
Suppose my original data table looks like:
DT_orig <- data.table(name = c("A", "A", "A", "B", "B", "B"),
…

plausibly_exogenous
- 500
- 2
- 10
1
vote
1 answer
Using dplyr::tbl inside function
I now there are various answers on using dplyr inside function but i tried all methods and neither worked.
Here is my simple function:
loadData_gfi_zse <- function(table_name = "mytable_name"){
con <- DBI::dbConnect(RMySQL::MySQL(),
…

Mislav
- 1,533
- 16
- 37
1
vote
1 answer
How to retain data.table class when piped through dplyr::filter?
I have a data.table object, which I'm piping through few dplyr functions.
When passed through dplyr::select, the class of resulting object is data.table + data.frame.
But when I pass it through dplyr::filter, class of output is data.frame…

Ashrith Reddy
- 1,022
- 1
- 13
- 26
0
votes
2 answers
Is there an alternative to "ifelse(any(startsWith" in data.table package?
So I am trying to convert my dplyr into DT for quicker processing time, but I am unable to convert my ifelse(any(startsWith... statement to DT. Whatever I try, it keeps doing one extreme or the other, or with the case of "Tag" it just says it…

user165426
- 7
- 4
0
votes
0 answers
R bench package gives a strange error when I try to use the tidytable package
I'm trying to augment the benchmarks in this article with the tidytable package](https://www.tidyverse.org/blog/2023/04/performant-packages/#tools-of-the-trade).
When I add tidytable to a benchmark, I get a strange error:
Error: Each result must…

abalter
- 9,663
- 17
- 90
- 145
0
votes
0 answers
How to split table into multiple pages while keep the categories in the first column with huxtable/gt?
I am generating a summary table and output to an rtf file. In this table, the first column is the categories, and the other columns are the counts of different groups. I would like to split this wide table into two pages but keep the first column on…

Charlie
- 1
- 1
0
votes
0 answers
R Error in env_has(env, var, inherit = TRUE) : attempt to use zero-length variable name
Sample data
ACCOUNT <- c("M191212", "M205668", "M197954", "M208966", "M193465", "M207622", "M191869")
PRODUCT <- c(1, 2, 3, 1, 2, 3, 2)
This is made into a dataset by lazy_dt() and as_tibble() …

Pendragon
- 119
- 9
0
votes
2 answers
data.table::frollapply does not work as expected when the input is a column of lists
I am having problems with frollapply from the data.table package. I have a dataset with a target_var column that consists of lists of equal length containing either numeric entries or NAs. I want to calculate the number of unique entries in these…

MoltenLight
- 62
- 5
0
votes
2 answers
How to get an entire column from a table with multiple columns on a condition that the column contains a specific value in R
I have a simple table in R which contains 3 columns (named 'countries_A', 'countries_B', and 'countries_C') each containing 4 countries. Now what I would like to do is write a function that searches in the table for a specific country, say "Italy",…

The Curious One
- 63
- 5