easystats生態(tài)之report包,報告你統(tǒng)計的一切需要

方法總覽


#英文教程原網址:https://easystats.github.io/report/

library(tidyverse)
library(easystats)

rm(list = ls()) 
options(stringsAsFactors = T)

#基本用法解釋
# The report package works in a two step fashion. 
# First, you create a report object with the report() function. 
# Then, this report object can be displayed either textually (the default output) 
# or as a table, using as.data.frame(). 
# Moreover, you can also access a more digest and compact version of the report using summary() on the report object.

#報告數(shù)據(jù)集情況
report(iris)

#可以用summary精簡報告
iris %>%
  select(-starts_with("Sepal")) %>%
  group_by(Species) %>%
  report() %>%
  summary()

#對T檢驗進行報告
report(t.test(mtcars$mpg ~ mtcars$am))


#對結構進行整理并構成列表
res<- cor.test(iris$Sepal.Length, iris$Sepal.Width) %>%
  report() %>%
  as.data.frame();res

#對方差分析進行報告
aov(Sepal.Length ~ Species, data = iris) %>%
  report()


#對廣義線性模型中的邏輯回歸進行報告
model <- glm(vs ~ mpg * drat, data = mtcars, family = "binomial")

report(model)


#混合效應模型
library(lme4)

model <- lme4::lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris)

report(model)

#提取最終報告的部分內容
model <- lm(Sepal.Length ~ Species, data = iris)

report_model(model)
report_performance(model)
report_statistics(model)


#分組匯總數(shù)據(jù)并報告
res1<- iris %>%
  group_by(Species) %>%
  report()%>%
  as.data.frame()

res2<- iris %>%
  group_by(Species) %>%
  report_table()

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容