R/word_table.r

# #' Word output
# #' @noRd
# word_out3 <- function(filename,
#                       reportTables) {
#   # reportTables <- list()
#   # reportTables$fit.dt <- extract_fit(a1)
#   # reportTables$est.dt <- extract_est(a1)
#   # reportTables$grmest.dt <- a1$grm.par
#
#   my.doc <- read_docx()
#
#   fit.dt    <- reportTables$fit.dt %>% mutate_if(is.numeric, ~ round(.x, 3))
#   est.dt    <- reportTables$est.dt %>% mutate_if(is.numeric, ~ round(.x, 3)) %# >%
#     dplyr::select(lhs, op, rhs, est,se, pvalue)
#   grmest.dt <- reportTables$grmest.dt %>% mutate_if(is.numeric, ~ round(.x, 3# )) %>%
#     mutate(Variable = rownames(reportTables$grmest.dt), .before = a1)
#
#   fit.dt <- flextable(fit.dt) %>%
#     width(width = 1.5) %>%
#     flextable::font(fontname = "Times", part = "all") %>%
#     flextable::bold(i = c(1), part = 'header') %>%
#     # height(height = .2, part = "body") %>%
#     padding(padding = 0.3) %>%
#     # hrule(., rule = "exact") %>%
#     set_caption(caption = "Table. Fix indices")
#
#   est.dt <- flextable(est.dt) %>%
#     # height(height = .2, part = "body") %>%
#     flextable::font(fontname = "Times", part = "all") %>%
#     flextable::bold(i = c(1), part = 'header') %>%
#     padding(padding = 0.3) %>%
#     # hrule(., rule = "exact") %>%
#     set_caption(caption = "Table. Parameter estimates (SEM specification)")
#
#   grmest.dt <- flextable(grmest.dt) %>%
#     # height(height = .2, part = "body") %>%
#     padding(padding = 0.3) %>%
#     flextable::font(fontname = "Times", part = "all") %>%
#     flextable::bold(i = c(1), part = 'header') %>%
#     # hrule(., rule = "exact") %>%
#     set_caption(caption = "Table. Parameter estimates (GRM specification)")
#
#   table_add(my.doc,fit.dt)
#   body_add_break(my.doc, pos = "after")
#   table_add(my.doc,est.dt)
#   body_add_break(my.doc, pos = "after")
#   table_add(my.doc,grmest.dt)
#
#   print(my.doc, target = filename)
#   # print(my.doc, target = "test.docx")
# }
#
#
# table_add <- function(x.doc, x.tb) {
#   flextable::body_add_flextable(
#     x.doc,
#     value = x.tb,
#     align = "left"
#   )
#
#   body_add_par(x.doc, " ")
# }

Try the GRShiny package in your browser

Any scripts or data that you put into this service are public.

GRShiny documentation built on May 4, 2023, 1:07 a.m.