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

Implict rows/cols>0 assumption in arr_parts_combine #141

Open
MichaelChirico opened this issue Mar 1, 2021 · 1 comment · May be fixed by #164
Open

Implict rows/cols>0 assumption in arr_parts_combine #141

MichaelChirico opened this issue Mar 1, 2021 · 1 comment · May be fixed by #164

Comments

@MichaelChirico
Copy link

repr::repr_text(matrix(nrow = 0, ncol = 100))
# Warning message:
# In cbind(parts$left, ellip_h, parts$right, deparse.level = 0L) :
#   number of rows of result is not a multiple of vector length (arg 2)

Ditto

repr::repr_text(matrix(ncol = 0, nrow = 100))
# Warning message:
# In rbind(parts$upper, ellip_v, parts$lower, deparse.level = 0L) :
#   number of columns of result is not a multiple of vector length (arg 2)

The diagnosis is simple enough; here:

repr/R/repr_matrix_df.r

Lines 84 to 85 in 7f27d6a

rows = rbind(parts$upper, ellip_v, parts$lower, deparse.level = 0L),
cols = cbind(parts$left, ellip_h, parts$right, deparse.level = 0L),

rbind/cbind is combining 0-length input with length-1 input (ellip_v/ellip_h).

I'm not 100% sure the correct behavior/best fix, however.

@MichaelChirico
Copy link
Author

MichaelChirico commented Mar 31, 2023

Bumping here, it's still a pretty common issue to wind up with dim-0 results and get spurious warnings.

Any thoughts on the right solution @flying-sheep? Happy to file a PR with a solution

@flying-sheep flying-sheep linked a pull request Apr 3, 2023 that will close this issue
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 a pull request may close this issue.

1 participant