jcarlos
jcarlos

Reputation: 435

Printing gt table with rmarkdown::render not working

I have this report.Rmd example below

---
title: "Report"
author: "Me"
date: "`r format(Sys.time(), '%d de %B de %Y')`"
output:
  html_document
---

## Test

```{r first,  echo=FALSE, message=FALSE, results='asis'}
library(tidyverse)
library(gt)
print( mtcars %>% gt() )

```

it works fine in Knit with RStudio

but when I try to create it from an external file this way

rmarkdown::render('report.Rmd', output_file = paste0('report.html'))

It shows all the messages and outputs in the console and in view pane, generates de html file, but it does not print the gt table.

What am I missing?

Upvotes: 2

Views: 1443

Answers (1)

Jakub.Novotny
Jakub.Novotny

Reputation: 3047

Just remove the print function. mtcars %>% gt()

Upvotes: 2

Related Questions