knitr failing to knit, RDS object not found

I am trying to write an R markdown script with a table in it and I am having trouble getting the document to knit properly.

This is the entirety of my markdown document (ignore the \s before the ticks it I need to escape ticks somehow).

---
title: "Extension Write Up"
author: "Kate Champion"
date: "2024-11-28"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
\```


Text to fill in later

```{r print_table}
setwd("my/working/directory/")
readRDS("02_code/table_1.rds")
table_1
\```

table_1 is a tinytable I saved out from a script that I want to be displayed inline in the final document. If I hit 'run current chunk' in the r print_table section it works fine it calls the object and I can see it displayed in the Rmd file. But everytime I try to knit to a pdf I get an error (see below). Also I get the same results regardless if the last line is print(table_1) or just table_1.

  |.............................................           |  80% [print_table]

processing file: extension_writeup.Rmd
                                                                                                        
Error:
! object 'table_1' not found
Backtrace:
  1. rmarkdown::render(...)
  2. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  3. knitr:::process_file(text, output)
  6. knitr:::process_group(group)
  7. knitr:::call_block(x)
     ...
 14. base::withRestarts(...)
 15. base (local) withRestartList(expr, restarts)
 16. base (local) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
 17. base (local) docall(restart$handler, restartArgs)
 19. evaluate (local) fun(base::quote(`<smplErrr>`))

Quitting from lines 16-19 [print_table] (extension_writeup.Rmd)
Execution halted

I am not sure why it's able to call the RDS object just fine when I run the chunk be itself but it fails when I try to knit the whole document.

Also my goal is to get a table in an Rmd file so if there is a better way to do that please let me know. Most of the examples I saw online had you running the full regression inside the markdown file before printing the results to a table but I don't want to put my full regression spec in the markdown because it's quite complicated. table_1 was generated using modelsummary and tinytable and then saved out using SaveRDS. I would be ok saving my regression output and then generating the table directly in the markdown if that's the better route to go.

I am duplicating the problem but I cannot even run the chunk.

I have had a couple of problems with {tinytable }in the last 2 days. I have had a Quarto/tinyable problem plus tinytable caption appearing at bottom of the table - #3 by jrkrideau.

I did an update.packages(ask = FALSE) earlier yesterday and I am beginning to wonder if we have some bug or bugs in a new iteration of {tinytable} .

Let me amend my last message.
If I create and save a tinytable

library(tinytable)
library(data.table)

DT <- data.table(AA = LETTERS[1:20], BB = sample(1:7, 20, replace = TRUE))
TAB1 <- tt(DT, caption = cap )
saveRDS(TAB1, "my_table.rds")

Then

---
title: "Quarto Tinytable"
author: "jrkrideau"
date: today
pdf-engine: pdflatex
format: pdf
header-includes:
   - \usepackage[version=3]{mhchem}
   - \usepackage{float}
   - \floatplacement{table}{H}
   - \usepackage{lipsum}
---

```{r}
#| label: load-libs
#| echo: false

library(tinytable)
\```

\lipsum[2]


```{r tt_table}
#| label: tt_table
#| echo: false
readRDS("my_table.rds")
\```

It seems to work.  Note the lack of a print command.

I am still having my caption problem  from yesterday.

Updating TinyTex and removing the any sort of print command seem to have fixed the knitting problem.