jacob-long / jtools

Tools for summarizing/visualizing regressions and other helpful stuff
https://jtools.jacob-long.com
GNU General Public License v3.0
165 stars 22 forks source link

export_summs error in saving to word file #85

Closed prossini closed 4 years ago

prossini commented 4 years ago

Hi! I just updated jtools to the latest version (2.1.0) and it "broke" export_summs. When I run export_summs without saving to a file it works fine, but when adding to.file = "word" i get the following error:


 export_summs(model,  error_format =  "SE: {std.error}, ({statistic}, p = {p.value}) ", error_pos = "right", to.file = "word", file.name = "test.docx")

Error in delete_cols(x, idx) : Tried to delete a non-existent column

This doesn't happen if I just print the model in R -- it's the export to file part that causes the issue. 

I think it was updating jtools that broke it but I updated all my packages so it could be a dependency? Thoughts?

things I tried and didn't work

1) downgrading jtools to 2.0.0 2) upgrading my r - was 3.6.2 (2019-12-12) now is 4.0.2 (2020-06-22) 3) stripping out everything else from the code to just leave model and to.file -- also doesn't work.

another update:

So I can save a regression table to docx using Huxtable with the following code, but still can't get export_summs to work.


library(huxtable)
x <- huxreg(model, error_format =  "SE: {std.error}, ({statistic}, p = {p.value}) ", error_pos = "right", coefs = coef_wp )
quick_docx(x, file = "huxtable-output.docx", borders = 0.4,
           open = interactive())
cvaccari commented 4 years ago

I am having the exact same problem so any help would be hugely appreciated!

jacob-long commented 4 years ago

I'm thinking this must be related to the June 16th release of a major update to huxtable. I have a quick fix that doesn't error, but so far the output looks badly formatted for some reason. Hoping to sort that out shortly.

jacob-long commented 4 years ago

Okay, the latest version of jtools on Github should have this fixed. Use the following code to update:

devtools::install_github("jacob-long/jtools")

Let me know if there's any other issues with the output since I haven't tested this very extensively.

emmanuelmahieux commented 4 years ago

Hi Jacob,

Thanks for releasing the latest version of jtools. When I run your line of code:

devtools::install_github("jacob-long/jtools")

I get the following error message:

Error: (converted from warning) Setting LC_CTYPE failed, using "C" Execution halted Error: Failed to install 'jtools' from GitHub: (converted from warning) installation of package '/var/folders/np/77_grrxj0n1fxsscggw4pwkm0000gn/T//Rtmpuxm2ij/file160553f450f82/jtools_2.1.1.9000.tar.gz' had non-zero exit status

and when I run export_summs I still get the "Error in delete_cols(x, idx) : Tried to delete a non-existent column" described in this thread.

Any suggestions on how to install the latest version of jtools and make export_summs work would be hugely appreciated as I find it a great way to present multiple models.

Thanks in all cases! Emmanuel

thestudi commented 4 years ago

@emmanuelmahieux

I had the same problem, but you can solve it using the huxtable package.

quick_docx(export_summs(fit, fit2), file = "test.docx")

by using the quick_ function you receive the same table but have no error.

Hope this helps :)

my-little-republic commented 4 years ago

Hi there. I have met the same problem. I need to export the results of both a general linear model (lm) and a mixed-effects model (lmer) The quick_docx function did work for the former model. But when it comes to the mixed-effects model, it's not working. Whether I use the lme4 package or lmerTest package, it keeps giving these alarms: Error: No tidy method for objects of class lmerModLmerTest or Error: No tidy method for objects of class lmerMod

I really like the output arranged by summ function. Really hope the export_summs function could be fixed.

By now I think I have to type in them manually...

emmanuelmahieux commented 4 years ago

Hi @thestudi, thanks for the advice! I used the huxreg( ) function and then the quick_docx( ) function from the huxtable( ) package and it does the same thing as export_summs( ) without any error messages. Cheers!

jacob-long commented 4 years ago

Hi @emmanuelmahieux, I'm not sure about the origin of your problem installing from Github, but that's the reason you're continuing to struggle with the initial error reported here.

@my-little-republic, the error message you're getting is due to the broom package no longer supporting merMod objects. If you install broom.mixed, I don't think you should have an error anymore.