knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(gt)
mpg.hp <- mtcars %>%
select(mpg, hp) %>%
gt() %>%
cols_label(mpg = "Miles per Gallon", hp = "Horsepower") %>%
tab_header(title = "Car Info") %>%
cols_align(align = c("auto")) %>%
fmt_number(columns = 1, decimals = 2) %>%
fmt_number(columns = 2, decimals = 1)
mpg.hp
Just trying to do something basic like make a dataframe into a table and knit a PDF with that table in it via RMarkdown. It will knit as an HTML but it won't knit as a PDF unless I remove the mpg.hp call. And when I try to knit to PDF I get:
! LaTeX Error: There's no line here to end. Error: LaTeX failed to compile stackoverflow1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See stackoverflow1.log for more info. Execution halted
I've visited the website in the Error message and followed the instructions. I've also tried using inline code to call the table, all with no success. Any suggestions?
R
? – max