This is my first time dealing with R Markdown and shiny. I've created an RMD which has a chunck with some data that I imported from a RDS document and I've made this data to be interactive using shiny tools (with help from Chat GPT). In my browser the html works perfect, but when i try to create a html_document to send to the team I'm working with, the html is no longer interactive and the data is vanished. Can anybody help me, please? Don't bother the comments in portuguese. Here's the chunk:
{r Dados, echo=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}
library(rmarkdown)
library(shiny)
library(DT)
# Configurar um espelho para o CRAN
options(repos = c(CRAN = "https://cran.rstudio.com/"))
# Carregar os dados especĂficos para MoM e YoY
mom_data <- readRDS("C:/Users/MOM.rds")
yoy_data <- readRDS("C:/Users/YOY.rds")
>! Criar interface Shiny com guias
shinyApp(
ui = fluidPage(
tabsetPanel(
tabPanel("%MoM-sa", value = "MoM",
dataTableOutput("tabelaMoM")),
tabPanel("%YoY-nsa", value = "YoY",
dataTableOutput("tabelaYoY"))
)
),
server = function(input, output) {
# Renderizar tabela especĂfica para %mom-sa
output$tabelaMoM <- renderDataTable({
datatable(mom_data)
})
# Renderizar tabela especĂfica para %yoy-nsa
output$tabelaYoY <- renderDataTable({
datatable(yoy_data)
})
}
)
To give some information, I have tried to convert it into a html_document using render(mydocument.Rmd, output_format = "html_document", runtime = "shiny"). I also tried to do Ctrl + S in my browser html but it still do not had the data. I have tried all things but nothing seems to work. I don't really know what it is supposed to happen when we "knit" (it became "Run Document" when I started using shiny) the RMD, because when I created it, I did specified that i want a html document as an output and in my console/render does appear a message like "Output created: C:/Users/AppData/Local/Temp/Rtmp253Vw5/file50e87bb9401c/teste1.html" but when i reach out to that file it just does not follow the pattern of the original RMD and it also does not contains the data.