Skip to content

Error in cross table in presence of NA #40

@aravindhebbali

Description

@aravindhebbali

Error in the grand total displayed in ds_cross_table() in the presence of NA's.

library(descriptr)
mt <- mtcarz
mt[c(3, 6, 9, 12), c(2, 3, 5, 6, 8, 10)] <- NA
ds_cross_table(mt, gear, cyl)
#>     Cell Contents
#>  |---------------|
#>  |     Frequency |
#>  |       Percent |
#>  |       Row Pct |
#>  |       Col Pct |
#>  |---------------|
#> 
#>  Total Observations:  32 
#> 
#> ----------------------------------------------------------------------------
#> |              |                            cyl                            |
#> ----------------------------------------------------------------------------
#> |         gear |            4 |            6 |            8 |    Row Total |
#> ----------------------------------------------------------------------------
#> |            3 |            1 |            1 |           11 |           13 |
#> |              |        0.031 |        0.031 |        0.344 |              |
#> |              |         0.08 |         0.08 |         0.85 |         0.41 |
#> |              |         0.11 |         0.17 |         0.85 |              |
#> ----------------------------------------------------------------------------
#> |            4 |            6 |            4 |            0 |           10 |
#> |              |        0.188 |        0.125 |            0 |              |
#> |              |          0.6 |          0.4 |            0 |         0.31 |
#> |              |         0.67 |         0.67 |            0 |              |
#> ----------------------------------------------------------------------------
#> |            5 |            2 |            1 |            2 |            5 |
#> |              |        0.062 |        0.031 |        0.062 |              |
#> |              |          0.4 |          0.2 |          0.4 |         0.16 |
#> |              |         0.22 |         0.17 |         0.15 |              |
#> ----------------------------------------------------------------------------
#> | Column Total |            9 |            6 |           13 |           32 |
#> |              |        0.281 |        0.187 |        0.406 |              |
#> ----------------------------------------------------------------------------

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions