Codes below display table. I like to see subject and direction columns display once based on subject group (see attached excel sheet). Is that doable in R? Thank you!
title: "Untitled"
output: pdf_document
date: "2023-07-19"
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
library(tidyverse)
library(gridExtra)
library(knitr)
library(kableExtra)
disp <- tibble::tribble(
~Subject, ~Direction, ~Peiod, ~Rate,
"ALC-05a", "Lower", "10/2021", 0,
"ALC-05a", "Lower", "11/2021", 0.05,
"ALC-05a", "Lower", "12/2021", 0.025,
"ALC-05a", "Lower", "10/2021", 0,
"ALC-05b", "High", "11/2021", 0.012987012987013,
"ALC-05b", "High", "12/2021", 0.0208333333333333,
"ALC-05b", "High", "10/2021", 0,
"ALC-05b", "High", "11/2021", 0.0046,
"ALC-05b", "High", "12/2021", 0
)
df <- disp %>% as.data.frame() %>%
mutate(Rate=Rate*100)
df %>%
kable(digits=1,"latex", align='lccc') %>%
kable_styling('bordered', font_size =10, position = "left") %>%
row_spec(0, bold=TRUE) %>%
column_spec(1, width="9cm",border_left = TRUE) %>%
column_spec(2:3, width="1.8cm") %>%
column_spec(4,width="2cm",border_right = TRUE)