I tried running my complete R file with another laptop in order to assess the reproducibility of my code. However, I run into an error code in R, which I do not run into with my own laptop. This is the error that arises:
Error in assert_package("quick_docx", "flextable"):
`quick_docx` requires the "flextable" package. To install, type:
install.packages("flextable")
My code for installing the packages is the following:
rm(list = ls(all.names = TRUE))
set.seed(211917)
options(scipen=999)
options(warn = -1)
packages <-c("RColorBrewer","ggsci","pwr","rio", "tidyverse", "haven", "plyr", "dplyr", "ggplot2", "writexl", "readxl",
"ipw", "lmtest", "car","rio", "haven", "modelsummary", "fixest", "sandwich", "marginaleffects",
"stargazer", "olsrr", "estimatr", "jtools", "huxtable", "broom", "broom.mixed", "officer", "flextable")
new.packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
lapply(packages, require, character.only = TRUE)
rm(packages, new.packages)
I have tried to install and load flextable
separately, right after the code block from above, but every time the export_summs()
function (from the jtools package) should be run, the error arises again.
This is an example of how I use the export_summs function, in case it is relevant:
export_summs(model1, model2, robust = TRUE, cluster ="ID", to.file = "docx", file.name = "Results/Table1.docx")
Is there maybe a conflict with different packages? But I don’t think that can be the problem as the code works on my laptop.
I thank you for your assistance on this matter.