Skip to content
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

simplify format_col.default, allowing e.g. vctrs_list_of columns to print well #6637

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MichaelChirico
Copy link
Member

Closes #5948

Turns out, this code in support of #2273 (#5224) is not needed -- I don't notice any difference before/after this change and we pass the related test:

if (loaded[["sf"]]) { #2273
DT = as.data.table(st_read(system.file("shape/nc.shp", package = "sf"), quiet=TRUE))
test(15, DT[1:3, .(NAME, FIPS, geometry)], output="Ashe.*-81.4.*Surry.*-80.4")
dsf = sf::st_as_sf(data.table(x=1:10, y=1:10, s=sample(1:2, 10, TRUE)), coords=1:2)
test(16, split(dsf, dsf$s), list(`1` = dsf[dsf$s == 1, ], `2` = dsf[dsf$s == 2, ]))
}

It's possible our testing is just not extensive enough.

Copy link

github-actions bot commented Dec 6, 2024

Comparison Plot

Generated via commit 867773f

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 4 minutes and 41 seconds
Installing different package versions 7 minutes and 34 seconds
Running and plotting the test cases 2 minutes and 12 seconds

@MichaelChirico
Copy link
Member Author

This test fails:

registerS3method("format", "foo2130", function(x, ...) rep("All hail foo",length(x)))
test(2130.15, print(DT), output="All hail foo")  # e.g. sf:::format.sfc rather than sf:::format.sfg on each item

My sense is that if we only fail a toy example, we should just break it. In general I am thinking the better solution here is to add format_col and/or format_list_item methods as needed.

I think given the potential for breaking change, it's best to save this PR for 1.18.0.

@MichaelChirico MichaelChirico added this to the 1.18.0 milestone Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

list sub-class with format() method prints full contents
1 participant