Closed robertogilsaura closed 2 years ago
Hi @gdemin
Nowadays, when we use function where in expss package, result is an object etable, but if we use the functon maditr::rows results in data.table.
where
etable
maditr::rows
data.table
Running this code ...
df <- data.frame(x=c(1,1,1,1,1,1,1,1,1,1,1,2,2,2,3,4,5)) library(expss) library(maditr) tab <- df %>% tab_cols(total(label='|')) %>% tab_cells('|'=unvr(x)) %>% tab_stat_cases(total_row_position = 'none', label='casos') %>% tab_stat_cpct(total_row_position = 'none', label='pct') %>% tab_last_hstack() %>% tab_pivot() tab <- where(tab,pct>50) tab <- let(tab, pct=NULL) tab tab1 <- df %>% tab_cols(total(label='|')) %>% tab_cells('|'=unvr(x)) %>% tab_stat_cases(total_row_position = 'none', label='casos') %>% tab_stat_cpct(total_row_position = 'none', label='pct') %>% tab_last_hstack() %>% tab_pivot() tab1 <- etable(rows(tab1, pct>50)) tab1 <- let(tab1, pct=NULL) tab1 tab2 <- df %>% tab_cols(total(label='|')) %>% tab_cells('|'=unvr(x)) %>% tab_stat_cases(total_row_position = 'none', label='casos') %>% tab_stat_cpct(total_row_position = 'none', label='pct') %>% tab_last_hstack() %>% tab_pivot() tab2 <- rows(tab2, pct>50) tab2 <- let(tab2, pct=NULL) tab2
we can test that object tab and tab1 are class etable but tab2 is class data.table. Function let show different ouput, too.
tab
tab1
let
Will it be like this in the future?
PD. I have any code with this mixing where and let and I'ld want to avaluate the impact with this change.
Thanks in advance. Great job!!! We look forward to the new, more simplified version to add new features. Regards.
Hi, @robertogilsaura
There will be a method called rows.etable. And rows will return etable. As you can see let already has this method.
rows.etable
rows
Good news !
Thanks, Gregory .
Hi @gdemin
Nowadays, when we use function
where
in expss package, result is an objectetable
, but if we use the functonmaditr::rows
results indata.table
.Running this code ...
we can test that object
tab
andtab1
are classetable
but tab2 is classdata.table
. Functionlet
show different ouput, too.Will it be like this in the future?
PD. I have any code with this mixing
where
andlet
and I'ld want to avaluate the impact with this change.Thanks in advance. Great job!!! We look forward to the new, more simplified version to add new features. Regards.