
方法總覽
#英文教程原網址: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()