You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 class nice_table, collides with rempsyc::nice_table(), also of class nice_table, simply when afex is loaded (and remains after being detached).
The specific issue is that afex:::print.nice_table() uses print.data.frame(x) on the flextable object, but then does not return the flextable, or rather, return it invisibly, with invisible(x).
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 a flextable class).
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)
.afex/R/nice.R
Lines 338 to 349 in 1e3ee8d
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
The text was updated successfully, but these errors were encountered: