I would like to make a table in R that I can convert into Latex Code with the months as the names of the rows, and the Category as the name of the columns. In each "cell" that corresponds to a month and category, I would like to have meantotrob2 and stdtotrob2 below meantotrob2 in small parentheses. Here is what part of my dataframe looks like.
label Category meantotrob2 stdtotrob2
<fct> <dbl> <dbl> <dbl>
1 April 1 0.122 0.361
2 April 2 0.121 0.288
3 April 3 0.123 0.297
4 April 4 0.0996 0.248
5 May 1 0.0878 0.206
6 May 2 0.0776 0.182
Months 1 2 3
# April 0.12162162 0.12111801 0.12278761
**0.361** **0.288** **0.297**
# May 0.08783784 0.07763975 0.09734513
**0.206** **0.182** **0.259**
This is what I'm looking for. Standard errors are in bold. Also, here is my head of the dataframe
structure(list(label = structure(c(1L, 1L, 1L, 1L, 2L, 2L), .Label = c("April",
"May", "June", "July(1-17)", "July(18-31)", "August", "September",
"October", "November", "December"), class = "factor"), Category = c(1,
2, 3, 4, 1, 2), meantotrob2 = c(0.121621621621622, 0.12111801242236,
0.122787610619469, 0.0995575221238938, 0.0878378378378378, 0.077639751552795
), stdtotrob2 = c(0.361428596863379, 0.287914904504829, 0.297434540363719,
0.248141256461657, 0.205954891705483, 0.181650473189414)), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -6L), groups = structure(list(
label = structure(1:2, .Label = c("April", "May", "June",
"July(1-17)", "July(18-31)", "August", "September", "October",
"November", "December"), class = "factor"), .rows = structure(list(
1:4, 5:6), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -2L), .drop = TRUE))