[R] print data.frame with a list column

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Mon Jan 29 15:56:12 CET 2024


On Mon, 29 Jan 2024 14:19:21 +0200
Micha Silver <tsvibar using gmail.com> wrote:

> Is there some option to force printing the full list?

> df <- data.frame("name" = "A", "bands" = I(list(1:20)))

format.AsIs is responsible for printing columns produced using I(). It
accepts a "width" argument:

format(x, width = 9999)
#   name                                                                 bands
# 1    A 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

It's more complicated with knitr::kable. Its format.args argument is
only used with numeric arguments, but you can pre-format the table with
knitr::kable(format(x, width = 9999)).

-- 
Best regards,
Ivan



More information about the R-help mailing list