Hello Rstudio community,
Using rmarkdown , some columns of the tables mixed up or not shown in the word document . Please see below code. Wondering if there is a global table format code to fix this. Appreciate your help.
Thanks
---
title: "Table"
author: "table width"
date: '2022-05-20'
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Table format issue
The last columns of my tables not appeared in the word document.
```{r cars}
cars$type<-as.character(c("a", "b", "c", "d", "e"))
summary(cars)
library(dplyr)
cars %>%
group_by(type) %>%
summarize(count = sum(!is.na(speed)),
missing= sum(is.na(speed)),
min = min(speed,na.rm = TRUE),
q1 = quantile(speed, 0.25, na.rm = TRUE),
median = median(speed, na.rm = TRUE),
mean = mean(speed, na.rm = TRUE),
mean.sd = sd(speed, na.rm = TRUE),
q3 = quantile(speed, 0.75, na.rm = TRUE),
max = max(speed, na.rm = TRUE) )%>%
mutate(mean.se = mean.sd / sqrt(count),
mean.lci = mean - qnorm(0.975) * mean.se,
mean.uci= mean + qnorm(0.975) * mean.se)
cars %>%
group_by(type) %>%
summarize(count = sum(!is.na(dist)),
missing= sum(is.na(dist)),
min = min(dist,na.rm = TRUE),
q1 = quantile(dist, 0.25, na.rm = TRUE),
median = median(dist, na.rm = TRUE),
mean = mean(dist, na.rm = TRUE),
mean.sd = sd(dist, na.rm = TRUE),
q3 = quantile(dist, 0.75, na.rm = TRUE),
max = max(dist, na.rm = TRUE) )%>%
mutate(mean.se = mean.sd / sqrt(count),
mean.lci = mean - qnorm(0.975) * mean.se,
mean.uci= mean + qnorm(0.975) * mean.se)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```