I have a df with this structure:
structure(list(x2023m06 = c(8714, 4184), x2023m05 = c(9633, 5879
), x2023m04 = c(8454, 4223), x2023m03 = c(6841, 800), x2023m02 = c(4293,
519), x2023m01 = c(2461, 431), x2022m06 = c(9632, 4106), x2022m05 = c(10307,
4300), x2022m04 = c(8879, 2427), x2022m03 = c(4616, 597), x2022m02 = c(6846,
641), x2022m01 = c(".", ".")), row.names = c("ResidentsA",
"ResidentsB"), class = c("tbl_df", "tbl", "data.frame"
))
When I do
df2 <-df %>%
adorn_totals("row")
I get
structure(list(x2023m06 = c("8714", "4184", "Total"), x2023m05 = c(9633,
5879, 15512), x2023m04 = c(8454, 4223, 12677), x2023m03 = c(6841,
800, 7641), x2023m02 = c(4293, 519, 4812), x2023m01 = c(2461,
431, 2892), x2022m06 = c(9632, 4106, 13738), x2022m05 = c(10307,
4300, 14607), x2022m04 = c(8879, 2427, 11306), x2022m03 = c(4616,
597, 5213), x2022m02 = c(6846, 641, 7487), x2022m01 = c(".",
".", "-")), core = structure(list(x2023m06 = c(8714, 4184), x2023m05 = c(9633,
5879), x2023m04 = c(8454, 4223), x2023m03 = c(6841, 800), x2023m02 = c(4293,
519), x2023m01 = c(2461, 431), x2022m06 = c(9632, 4106), x2022m05 = c(10307,
4300), x2022m04 = c(8879, 2427), x2022m03 = c(4616, 597), x2022m02 = c(6846,
641), x2022m01 = c(".", ".")), row.names = c(NA, -2L), class = "data.frame"), tabyl_type = "two_way", totals = "row", row.names = c(NA,
-3L), class = c("tabyl", "tbl_df", "tbl", "data.frame"))
And new dataframe don't have expected row names: "ResidentsA", "ResidentsB", "Total". What is wrong?