Conversation
Codecov Report
@@ Coverage Diff @@
## master #4154 +/- ##
==========================================
+ Coverage 99.53% 99.54% +<.01%
==========================================
Files 72 72
Lines 13911 13915 +4
==========================================
+ Hits 13847 13851 +4
Misses 64 64
Continue to review full report at Codecov.
|
|
If I understand correctly, the current way for As for the s4 classes, I've added functionality to handle those and have tests for it. |
|
To clarify: s4class <- setClass("ex_class", slots = list(x = "integer", y = "character", z = "numeric"))
array1 = array(1:4, 2)
array2 = array(1:8, c(2,2))
array3 = array(1:16, c(2,2,2))
DT = data.table::data.table(
int = 1L:2L,
list = list(list(x = 1,
y = c("yes", "no")),
list(x = 2,
y = 2)),
s4 = list(s4class(x = 1L, y = "thing1", z = 3.4),
s4class(x = 2L, y = "thing2", z = 2.5)),
array1 = list(array1[1, drop = FALSE],
array1[2, drop = FALSE]),
array2 = list(array2[,1, drop = FALSE],
array2[,2, drop = FALSE]),
array3 = list(array3[,,1, drop = FALSE],
array3[,,2, drop = FALSE]),
named_vec = list(c("var1" = 1, "var2" = 2),
c("var1" = 3, "var2" = 4))
)
print(DT, class=TRUE)
#> int list s4 array1 array2 array3 named_vec
#> <int> <list> <list> <list> <list> <list> <list>
#> 1: 1 <list[2]> <ex_class[3]> 1 1,2 1,2,3,4 1,2
#> 2: 2 <list[2]> <ex_class[3]> 2 3,4 5,6,7,8 3,4So the arrays and named vectors don't print the class as of right now. |
|
I'm happy if codecov is happy re:tests :) Looks good overall; I just wonder whether we should patch up #3414 first and add this on to that |
|
That makes sense to me. Seems like #3414 is definitely broader in scope. Question: Does #3414 mostly have to do with printing list columns with custom classes and arrays/named vectors/matrices? That’s what it seemed to me from the discussion about using |
|
Technically that's enabled, yep, through the |
|
I like the flexibility. As for this PR, I’ll wait to hear back from you once things are more clear on #3414 |
|
Btw, why is your id @TysonStanley but your name Tyson Barrett? It doesn't matter really other than it catches me out w.r.t. to checking your name is in DESCRIPTION, and when thanking you in news. |
|
Great question. My middle name is Stanley and I thought I was being creative but, in hindsight, would have gone with something like "@tysonbarrett" instead... Thanks for working around it. |
|
I really like the idea that Michael said about using format_list_item to achieve what we need in this PR. Do you think you could follow-up later on with required changes when we have generic method in place? |
|
@jangorecki anyone can follow up. Tyson has achieved what he wanted, which closes an issue. We can't ask for more than that. |
Closes #3671
Prints dims with list-columns. For example:
This provides some additional information without printing too much and costs relatively little since it only applies to what is being printed, not the entire data table.