)]}'
{
  "commit": "69c8bd57db5fbfb11dc677bb20ba3a7a0ac449b6",
  "tree": "c6202506ba6b4c4ea51a6cf127185ce3752cb0d5",
  "parents": [
    "7e49c74670171de790ba81b3333ffd26912676f7"
  ],
  "author": {
    "name": "jokorn",
    "email": "jonatankornholt@outlook.com",
    "time": "Sat Jun 29 11:11:11 2019 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Sat Jun 29 11:11:11 2019 +0200"
  },
  "message": "Update group_header_rows attribute with new position when adding multiple group_rows to HTML table\n\nThere is an issue when adding multiple group_rows to a kable HTML table. When adding the second group_rows statement the positions are wrong because the positions of the first group_header_rows are not updated after adding the new group_header_rows. This line should fix this.\r\n\r\nExample .Rmd file:\r\n\r\n---\r\noutput:\r\n  html_document: default\r\n---\r\n\r\n```{r include\u003dFALSE}\r\n\r\n# Load libraries\r\nlibrary(tidyverse)\r\nlibrary(kableExtra)\r\n\r\n# Create test data\r\n# Nested groups. \"a\" only contains \"1\" and \"2\",\r\n# \"b\" only contains \"3\" and \"4\", \"c\" only \"5\" and \"d\" only \"6\"\r\ntest_data \u003c- tribble(\r\n  ~var1, ~var2, ~var3,\r\n  \"a\",   \"1\",    \"x\",\r\n  \"b\",   \"4\",    \"y\",\r\n  \"b\",   \"3\",    \"x\",\r\n  \"a\",   \"2\",    \"z\",\r\n  \"c\",   \"5\",    \"y\",\r\n  \"d\",   \"6\",    \"x\",\r\n  \"d\",   \"6\",    \"z\",\r\n  \"a\",   \"2\",    \"y\",\r\n  \"d\",   \"7\",    \"b\",\r\n  \"d\",   \"7\",    \"b\")\r\n\r\n# Sort data on var1 and var2 so we\u0027re able to group rows based on these\r\ntest_data_sorted \u003c- test_data %\u003e% \r\n  arrange(var1, var2)\r\n```\r\n\r\n```{r kable_one_group}\r\n# Create kable table and group rows based on var1 first\r\nkable_one_group \u003c- test_data_sorted %\u003e% \r\n  kable() %\u003e% \r\n  kable_styling(full_width \u003d FALSE) %\u003e% \r\n  group_rows(index \u003d test_data_sorted$var1 %\u003e% auto_index(),\r\n             group_label \u003d test_data_sorted$var1)\r\n\r\n# This works fine\r\nkable_one_group\r\n```\r\n\r\n\r\n```{r kable_one_group_other_var}\r\n# Create kable table and group rows based on var2 second\r\nkable_one_group_other_var \u003c- test_data_sorted %\u003e% \r\n  kable() %\u003e% \r\n  kable_styling(full_width \u003d FALSE) %\u003e% \r\n  group_rows(index \u003d test_data_sorted$var2 %\u003e% auto_index(),\r\n             group_label \u003d test_data_sorted$var2)\r\n\r\n#This works fine\r\nkable_one_group_other_var\r\n```\r\n\r\n```{r kable_two_groups_both_vars}\r\n# Then add another group of rows based on var2 to this table\r\nkable_two_groups \u003c- kable_one_group %\u003e% \r\n  group_rows(index \u003d test_data_sorted$var2 %\u003e% auto_index(),\r\n             group_label \u003d test_data_sorted$var2 %\u003e% auto_index,\r\n             indent \u003d FALSE)\r\n\r\n#This doesn\u0027t work as intended\r\nkable_two_groups\r\n```",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c7d517846b4db84d303e4ec1342d5ee67e773f60",
      "old_mode": 33188,
      "old_path": "R/group_rows.R",
      "new_id": "33a517cb9236d68afe007128496be3d88bd5da86",
      "new_mode": 33188,
      "new_path": "R/group_rows.R"
    }
  ]
}
