Skip to content

Error when more than one rowname is to be wrapped with indentation #85

@Melkiades

Description

@Melkiades

The following code:

set.seed(1)
tiris <- iris[sample(seq_len(nrow(iris)), 100), ]
library(rtables)
a <- basic_table() %>%
 analyze("Petal.Width",
         function(x) list("what a long string" = rcell(1.2), "also very long long" = rcell(1.3)), indent_mod = 1) %>%
 build_table(tiris) %>%
 print()

produces:

                       all obs
——————————————————————————————
  what a long string     1.2  
  also very long long    1.3  

while the following:

b <- matrix_form(a, indent_rownames = T)
cat(toString(b, widths = c(15, 5)))

crashes (without indentation this does not crash and it works):

Error in (function (x, n, just = c("center", "left", "right"))  : 
  "  also very long" has more than 15 characters

This is related to #84

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsmeTracks changes for the sme board

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions