strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science

Home Page:https://strengejacke.github.io/sjPlot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I view summary statistics?

ehsong opened this issue · comments

I really like this package since I am using MS word, but I can't find a way to obtain a descriptive statistic table or a summary statistics table. Is there a way to print this?

Hi, would this work for your data? You can create descriptive statistics using psych::describe(), print it using tab_df, and export it as a .doc.

library(tidyverse)
library(sjPlot)
library(psych)

data(airquality)

airquality %>%
  psych::describe() %>%
  tab_df(
    title = "here is my table",
    show.rownames = TRUE,
    file = "~/Documents/mytable.doc")

@jrcalabrese Thank you! I ended up using gtsummary and flextable to export the table to .doc, but I will try the psych library as well.

You could also use sjmisc::descr() and set argument out = "browser", and then copy/paste to word. Or you use datawizard::describe_distribution() and then use print_html() to print to HTML.