This is the code I used:
for(i in var){
a\<-Variables_summary%\>%group_by\_(i,"admission_year")%\>%summarise(grossclaim=sum(grossclaim))%\>%ungroup()
a\<-a%\>%arrange(admission_year)
a\<-pivot_wider(a,id_cols = i, names_from = "admission_year",values_from = "grossclaim" ,values_fill = 0)
colnames(a)\[2:5\]\<- paste0("gross_claim\_",colnames(a)\[2:5\])
a$`gross_claim_2019`\<-prettyNum(a$`gross_claim_2019`, big.mark = ',')
a$`gross_claim_2020`\<-prettyNum(a$`gross_claim_2020`, big.mark = ',')
a$`gross_claim_2021`\<-prettyNum(a$`gross_claim_2021`, big.mark = ',')
a$`gross_claim_2022`\<-prettyNum(a$`gross_claim_2022`, big.mark = ',')
print(kable(a)%\>%kable_classic_2(full_width=F, html_font = "Cambria")%\>%kable_styling(full_width = F, bootstrap_options = c("striped", "hover", "condensed"), position = "left", font_size = 12, fixed_thead = T)%\>%column_spec(1, bold = T, border_right = T, color = "black", background = "lightgrey"))
}
I attached an image of what the output was when I knitted it to html:
When trying to knit my document in Rmd to html, the output file I get for running this code isn't showing the tables that the kable function is supposed to output. In Rmd, the function runs just fine, but when I knit it there's a problem.