I'm using r-markdown to generate pdf. i want to add a line break or newline to a column in a dataframe where ever the space is there.
C1 C2 ID
-----------------
22.6 a-b a
23.5 ba-cd b
24 c-d c
25.3 d-e d
i want output like
C1 ID
-----------
22.6 a
a-b
23.5 b
ba-cd
my code
df$C1<- with(df, paste0(C1,'\n', C2))
df$C2<-NULL
kbl(df,booktabs = T,longtable = T,align = c("c", "c", "c", "c")) %>%
kable_styling(latex_options = c("repeat_header"),bootstrap_options = "bordered",font_size = 7,full_width = F)%>%
column_spec(1, width = "8cm")%>%
column_spec(2:4, width = "2.25cm")