-
-
Notifications
You must be signed in to change notification settings - Fork 873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kable output is suboptimal for data.tables with list columns that contain functions #2075
Comments
Thanks for the report. This is not an issue with data.table specifically but with list column in structure that supports it. > knitr::kable(tibble::tibble(a = list(head)))
|a |
|:-------------------------------------|
|function (x, ...) , UseMethod("head") | I don't think Printing list column is not something easy to do generically. What should be printed for such cells exactly ? I don't see a use case where using ---
title: "Test"
output: html_document
---
```{r}
tibble::tibble(a = list(head))
```
```{r}
data.table::data.table(a = list(head))
``` Is that expectation to have a markdown table containing the same information as the console printed version ? Thanks. |
Thanks for the quick answer, |
Which suggestion exactly ? Just to be sure I got it right. |
I understood it as you suggesting to e.g. represent the function head as <function[1]>. |
Maybe in general something like |
I wanted to confirm that this would be your expectation as a result of a This could be a way to output the content without creating those long unreadable contents. We would need process the table and transform the content before printing it a table. Seems something that could be considered. I still think that when this happens, one should prevent from using I'll add this as a feature request. Thanks for the suggestion. I think this is related to rstudio/rmarkdown#1822 (comment) where were |
I think the optimal outputs depend on users.
and so on... I would rather suggest define own format.list = function(x, ...) vapply(x, function(x) class(x)[[1L]], NA_character_)
knitr::kable(tibble::tibble(
x = list(head, rnorm)
)) |
Yes I agree - It is what I meant by "Printing list column is not something easy to do generically. What should be printed for such cells exactly ?" 😄 Regarding |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
The
knitr::kable
output is suboptimal for data.tables with list columns that contain functions (see reprex below).Created on 2021-11-17 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: