library(dplyr)
library(tidyr)

phiDfromFIM  <- function(M){
  return(det(M)^(1/dim(M)[1]))
}


# Function to print tables in LaTex format
cat_tab_latex <- function(my_tab){
  
  nCol = ncol(my_tab)
  stringNcol = paste(rep("c", times = nCol), collapse = " ")
  cat("\\begin{table}[]
\\centering
\\rowcolors{2}{lightgray!40}{}
\\caption{}
")
  cat(paste0("\\begin{tabular}{", stringNcol, "}"))
  cat("\\rowcolor{lightgray} \n")
  
  
  
  write.table(my_tab, file = "",
              row.names = FALSE,
              quote = FALSE,
              sep = " & ",
              eol = " \\\\ \n",
              append = TRUE)
  
  
  cat("\\end{tabular} \n label{tab:} \n \\end{table}")
  
  
}
