My render function to create the html file from the rmd file is as follows:
createReports <- reactive({
annual <- (some data...)
.....
rmarkdown::render(
input = RMD_FILE,
output_format = "html_document",
output_dir = "outputTest",
quiet = TRUE
)
However, when I run this line, The Rmd file loads fine but I get this error:
Quitting from lines 15-21 (5_Year_Average_Dividend_Growth_Rate.Rmd)
Error in nrow(annual) : object 'annual' not found
However, as you can see, I have defined the variable annual within the same function as the rmarkdown::render. However, when it goes into the function render, it does not recognize that there is a variable called annual. I debugged it and right before it goes into rmarkdown::render, the annual variable does exist. How can I fix this?