pander errors with descr::CrossTables if table has no row or col %
When using pander with descr::CrossTables, the generated markdown creates a table with duplicated row names.
see also post in here
This code:
x<- c('aaa','bbb','ccc')
y<- c('ddd', 'eee', 'fff')
t1 <- descr::CrossTable(x = x, y = y,
prop.c = FALSE,
prop.t = FALSE,
prop.r = FALSE,
prop.chisq = FALSE,
dnn = c('xlabel', 'ylabel'))
pander::pander(t1, digits = 1)
generates this markdown
-------------------------------------------------
\ ylabel\ \ \ \
xlabel ddd eee fff Total
--------- --------- --------- --------- ---------
**aaa**\ \ \ \ \
N\ 1 0 0 1
bbb\
aaa
**bbb**\ \ \ \ \
N\ 0 1 0 1
ccc\
bbb
**ccc**\ \ \ \ \
N\ 0 0 1 1
Total\
ccc
Total 1 1 1 3
-------------------------------------------------
See the repeated row labels bbb\ aaa on each row header.
For reference, if at least one % is requested, then the table is ok
This code:
t1 <- descr::CrossTable(x = x, y = y,
prop.c = FALSE ,
prop.t = FALSE,
prop.chisq = FALSE,
dnn = c('xlabel', 'ylabel'))
pander::pander(t1, digits = 1)
generates this markdown, without errors.
-------------------------------------------------
\ ylabel\ \ \ \
xlabel ddd eee fff Total
--------- --------- --------- --------- ---------
**aaa**\ \ \ \ \
N\ 1\ 0\ 0\ 1\
Row(%) 100.0% 0.0% 0.0% 33.3%
**bbb**\ \ \ \ \
N\ 0\ 1\ 0\ 1\
Row(%) 0.0% 100.0% 0.0% 33.3%
**ccc**\ \ \ \ \
N\ 0\ 0\ 1\ 1\
Row(%) 0.0% 0.0% 100.0% 33.3%
Total 1 1 1 3
-------------------------------------------------
Thanks for reporting this. @RomanTsegelskyi, if you have time, pls look into this as you worked on the function, if not, I'll try to resolve this -- or a related PR is highly welcomed.
Hi, this definitely seems like a bug, I will try to look into it during the weekend
Any news on fixing this problems?
Any updates regarding this issue?
It's not likely that I will have time to look into this soon, sorry, but would appreciate a PR.