Closed rempsyc closed 7 months ago
Thanks for alerting me of this. However, I am not sure if I can do much about this. The afex
print method follows the general structure of methods for the print
generic. It returns objects via invisible(x)
without changing the objects, see: https://stat.ethz.ch/R-manual/R-devel/library/base/html/print.html
I cannot see a corresponding print.nice_table
method in rempsyc
that could handle the object instead.
Maybe I am missing something, but on my brief look at your code, I cannot see any method for nice_table
objects. Thus, maybe the easiest solution would be to remove the class at your end. If you do not define methods for it, is there any reason to add the class to the object in the first place?
Good point, thanks! Yes, there are no methods for nice_table
objects yet, so I think you are right, I will remove it for now. Thank you for the suggestion! I think the reason was until now to leave a "signature trail" of how the table was made, as I had seen in other code.
FWIW, the workaround I was thinking for afex
(now outdated) was in the printing method to check for the exact classes afex::nice
produces, and return the object as is if it doesn't match.
Hello, I do not use package
afex
, but a user (see rempsyc/rempsyc#26 for reprexes) has reported an issue wherein the printing method for the function nice, which outputs an object of classnice_table
, collides withrempsyc::nice_table()
, also of classnice_table
, simply whenafex
is loaded (and remains after being detached).The specific issue is that
afex:::print.nice_table()
usesprint.data.frame(x)
on theflextable
object, but then does not return theflextable
, or rather, return it invisibly, withinvisible(x)
.https://github.com/singmann/afex/blob/1e3ee8d438795ad60129735ae09cc8458864c7dc/R/nice.R#L338-L349
How would you suggest addressing the issue?
A possibility is to update
afex::nice()
to make it more robust by adding a check that the object does not have additional classes (e.g.,rempsyc::nice_table()
also has aflextable
class).Created on 2024-02-22 with reprex v2.0.2