-
Notifications
You must be signed in to change notification settings - Fork 982
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
[BUG] Cannot print a data.table with column of type rvar
from posterior package
#5981
Comments
At root the issue is we don't do Apparently (#1433) we wrote our own Maybe we should implement |
…wap if logic in format_col.default
I have a PR at the link below to do the length dispatch in C. It's been a long time since I've written with R's C API so it may not be that nice. I also ran into another bug where
Since vectors of rvar types have a dimension |
Actually @MichaelChirico I think we should close this PR / issue. See the discussion in the comments here. Essentially this is another case of #4415 (specifically the comment here). At first I thought this was a data.table issue but now I think it's |
Thanks for the reminder. Indeed I'd checked if rvar is S4, but it's just S3 which I thought should be easier to accommodate in general. And indeed I wouldn't expect generic computations on rvar columns in data.table to work. But storing non-atomic columns in a data.table is still very useful for some high-level use cases, and something as basic as |
Yes I just was messing with
Would you like me to open up a PR for the fix branch I posted above? |
that'd be great! |
Summary
When printing a
data.table
that contains anrvar
type from theposterior
package an emptydata.table
is printed instead. See the mrp below for a full case. Looking into it more it appearsdim.data.table
returns a value of zero for the rows where there should be a nonzero value.dim
returning a zero causes line 55 ofprint.data.table
to go to the emptydata.table
message.I tried looking into the code for
dim
:data.table/src/wrappers.c
Lines 101 to 121 in 46ee525
The
data.table
has alength(x)
equal to 1 so the last branch is chosen.Calling
dim.data.frame
with the data.table gives the correct output below of (4, 1). I think this is because.row_names_info
used indim.data.frame
is just asking for the length of the row names via.Internal(shortRowNames(x, type))
.Minimal reproducible example
Looking over the open/closed issues for data.table I could not find anything similar. I don't know enough about R's internals to know why
length(VECTOR_ELT(x, 0))
is giving a value of zero, though I found the source forVECTOR_ELT
here#
Output of sessionInfo()
The text was updated successfully, but these errors were encountered: