replace threeparttable with threeparttablex;
Fixed #119
diff --git a/R/add_header_above.R b/R/add_header_above.R
index fc2b805..c452288 100644
--- a/R/add_header_above.R
+++ b/R/add_header_above.R
@@ -71,6 +71,11 @@
                                                    bold, italic, monospace,line)
   xml_add_child(kable_xml_thead, new_header_row, .where = 0)
   out <- as_kable_xml(kable_xml)
+  if (is.null(kable_attrs$header_above)) {
+    kable_attrs$header_above <- 1
+  } else {
+    kable_attrs$header_above <- kable_attrs$header_above + 1
+  }
   attributes(out) <- kable_attrs
   if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
   return(out)
diff --git a/R/collapse_rows.R b/R/collapse_rows.R
index 9feb93d..ec33c5a 100644
--- a/R/collapse_rows.R
+++ b/R/collapse_rows.R
@@ -46,7 +46,12 @@
   if (is.null(columns)) {
     columns <- seq(1, ncol(kable_dt))
   }
-  kable_dt$row_id <- rownames(kable_dt)
+  if (!is.null(kable_attrs$header_above)) {
+    kable_dt_col_names <- unlist(kable_dt[kable_attrs$header_above, ])
+    kable_dt <- kable_dt[-(1:kable_attrs$header_above),]
+    names(kable_dt) <- kable_dt_col_names
+  }
+  kable_dt$row_id <- seq(nrow(kable_dt))
   collapse_matrix <- collapse_row_matrix(kable_dt, columns)
 
   for (i in 1:nrow(collapse_matrix)) {
diff --git a/R/footnote.R b/R/footnote.R
index 9225ebf..0d1b3be 100644
--- a/R/footnote.R
+++ b/R/footnote.R
@@ -205,7 +205,7 @@
                                      table_info$ncol, threeparttable)
   if (threeparttable) {
       out <- sub(paste0("\\\\begin\\{", table_info$tabular, "\\}"),
-                 paste0("\\\\begin{threeparttable}\n\\\\begin{",
+                 paste0("\\\\begin{ThreePartTable}\n\\\\begin{",
                         table_info$tabular, "}"),
                  out)
     out <- sub(table_info$end_tabular,
@@ -213,7 +213,7 @@
                       "}\n\\\\begin{tablenotes}",
                       ifelse(footnote_as_chunk, "[para]", ""),
                       "\n\\\\small\n", footnote_text,
-                      "\n\\\\end{tablenotes}\n\\\\end{threeparttable}"),
+                      "\n\\\\end{tablenotes}\n\\\\end{ThreePartTable}"),
                out)
   } else if (table_info$booktabs) {
     out <- sub("\\\\bottomrule",
diff --git a/R/zzz.R b/R/zzz.R
index 74e9464..38c06b0 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -11,7 +11,7 @@
     usepackage_latex("colortbl")
     usepackage_latex("pdflscape")
     usepackage_latex("tabu")
-    usepackage_latex("threeparttable")
+    usepackage_latex("threeparttablex")
     usepackage_latex("ulem", "normalem")
   }
 }
diff --git a/inst/NEWS.md b/inst/NEWS.md
index 677ee46..ceb1a23 100644
--- a/inst/NEWS.md
+++ b/inst/NEWS.md
@@ -1,6 +1,9 @@
 kableExtra 0.7.1
 --------------------------------------------------------------------------------
 * Fixed #115, a bug in latex footnote about escaping.
+* Fixed #116, a bug about the position of footnote in longtable with booktabs
+* replace threeparttable with threeparttablex
+* Fixed #119, a bug between collapse_rows and add_header_above
 
 
 kableExtra 0.7.0