title: Who do i properly display a vtable in RMarkdown?
body: <p>since I am a newbee in RMarkdown and/or R in general, I am having a bit of trouble with the following:</p>
  <p>I would like to display a vtable (created using the library vtable) as a normal kable table in RMarkdown (I am creating a PDF with LaTex). I understand that vtable can give back a knitr kable and therefore it can be used as an input for kable_styling so i can tinker with the latex options. This seems to work up to a certain point.</p>
  <p>Here is the code so far:</p>
  <pre><code>vtable(heart_faliure_data, labels = label) %&gt;% 
  kable_styling(latex_options = c(&quot;striped&quot;, &quot;scale_down&quot;))
  </code></pre>
  <p>But the resulting table looks like this:
  <a href="https://i.stack.imgur.com/WBPit.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WBPit.png" alt="enter image description here" /></a></p>
  <p>Why are the latex command displayed at all?</p>
  <p>I am thankful of any help you can give me.</p>
  <p>The database can be found here: <a href="https://archive.ics.uci.edu/ml/datasets/Heart+failure+clinical+records" rel="nofollow noreferrer">https://archive.ics.uci.edu/ml/datasets/Heart+failure+clinical+records</a></p>
  <p>And here ist the complete Rmd File:</p>
  <pre><code>
      ---
      title             : &quot;Data mining using R for heart failure clinical records Dataset&quot;
      
      floatsintext      : yes
      figurelist        : yes
      tablelist         : yes
      footnotelist      : no
      linenumbers       : no
      linkcolor         : &quot;blue&quot;
      mask              : no
      draft             : no
      
      classoption       : &quot;doc&quot;
      output            : papaja::apa6_pdf
  documents
      header-includes:
      - \usepackage{booktabs}
      - \usepackage{longtable}
      - \usepackage{array}
      - \usepackage{multirow}
      - \usepackage{wrapfig}
      - \usepackage{float}
      - \usepackage{colortbl}
      - \usepackage{pdflscape}
      - \usepackage{tabu}
      - \usepackage{threeparttable}
      - \usepackage{threeparttablex}
      - \usepackage[normalem]{ulem}
      - \usepackage{makecell}
      - \usepackage{xcolor}
      ---
      
      ```{r include = FALSE}
      library(&quot;tidyverse&quot;)
      library(&quot;kableExtra&quot;)
      library(&quot;rsample&quot;)
      library(&quot;recipes&quot;)
      library(&quot;parsnip&quot;)
      library(&quot;yardstick&quot;)
      library(&quot;viridisLite&quot;)
      library(&quot;GGally&quot;)
      library(&quot;vtable&quot;)
      library(&quot;qwraps2&quot;)
      library(&quot;ggplot2&quot;)
      library(&quot;htmlTable&quot;)
      library(&quot;egg&quot;)
      library(&quot;dplyr&quot;)
      library(&quot;afex&quot;)
      library(&quot;papaja&quot;)
      library(&quot;kableExtra&quot;)
      library(&quot;magrittr&quot;)
      library(&quot;vtable&quot;)
      
      knitr::opts_chunk$set(echo = TRUE)
      heart_faliure_data &lt;- read.csv(file = &quot;../Data/heart_failure_clinical_records_dataset.csv&quot;, header = FALSE, skip=1)
      c_names &lt;- c(&quot;Age&quot;,
                   &quot;Anaemia&quot;,
                   &quot;cr_ph&quot;,
                   &quot;diabetes&quot;,
                   &quot;ejection_fraction&quot;,
                   &quot;high_blood_pressure&quot;,
                   &quot;platelets&quot;,
                   &quot;serum_creatinine&quot;,
                   &quot;serum_sodium&quot;,
                   &quot;sex&quot;,
                   &quot;smoking&quot;,
                   &quot;time&quot;,
                   &quot;DEATH_EVENT&quot;)
      colnames(heart_faliure_data) &lt;- c_names
      ```
      \newpage  
      # Introductiom
      
      ```{r echo=FALSE}
      knitr::kable(head(heart_faliure_data), booktabs = TRUE) %&gt;%
                kable_styling(latex_options = c(&quot;striped&quot;, &quot;scale_down&quot;))
      ```
      
      ```{r echo=FALSE}
      label &lt;- data.frame(
        Age = &quot;Age of the patient&quot;,
        Anaemia = &quot;Decrease of red blood cells or hemoglobin&quot;,
        creatinine_phosphokinase = &quot;level of the CPK enzyme in the blood (mcg/L)&quot;,
        diabetes = &quot;if the patient has diabetes&quot;,
        ejection_fraction = &quot;percentage of blood leaving the heart at each contraction&quot;,
        high_blood_pressure = &quot;if the patient has hypertension&quot;,
        platelets = &quot;platelets in the blood (kiloplatelets/mL)&quot;,
        serum_creatinine = &quot;level of serum creatinine in the blood (mg/dL)&quot;,
        serum_sodium = &quot;level of serum sodium in the blood (mEq/L)&quot;,
        sex = &quot;sex of the patient, woman or man&quot;,
        smoking = &quot;if the patient smokes or not&quot;,
        time = &quot;follow-up period&quot;,
        DEATH_EVENT = &quot; if the patient deceased during the follow-up period&quot;
      )
      
      vtable(head(heart_faliure_data), labels = label, out=&quot;latex&quot;) #%&gt;%
                kable_styling(latex_options = c(&quot;striped&quot;, &quot;scale_down&quot;))
      ```
  
  </code></pre>
  <p>Greetings!</p>
  <p>Edit: code formatting</p>