简体   繁体   中英

How to get a nicer output in Word from statistical tests using RMarkdown?

Most of the times the results of a statistical test are a list . I know that I only can use kable with a data frame. The following example is a Kolmogorov-Smirnov test (ks.test). There are also many at the psych library. I want to have a nicer output knitting to Word . How can this be done with a list like a ?

---
title: "ks test"
output:
  word_document: default
---

```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE, results="asis")
```


```{r}
x <- rnorm(50)
y <- runif(30)
# Do x and y come from the same distribution?
a <- ks.test(x, y)
a
```

You can possibly embed a table containing the information from this test?

library(parameters)

x <- rnorm(50)
y <- runif(30)
# Do x and y come from the same distribution?
mod <- ks.test(x, y)

print_html(model_parameters(mod))

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM