Error with DTOutput in my Shiny App

Hi everyone,

I’m developing a Shiny app that calculates taxes on cryptocurrency transactions, and I'm running into an issue with the DTOutput function.

Expected Behavior:
I expect the app to display a data table with transaction details once the "Calculate Tax" button is clicked.

Actual Behavior:
Instead, I receive the following error in the logs:
Warning: Error in DTOutput: could not find function "DTOutput"

Here are the relevant parts of my code:

library(shiny)
library(shinydashboard)
library(DT)

Define UI

ui <- dashboardPage(
dashboardHeader(title = "Tax Calculator"),
dashboardSidebar(
sidebarMenu(
menuItem("Tax Calculator", tabName = "tax_calculator", icon = icon("calculator"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "tax_calculator",
fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("currency", "Select Cryptocurrency:", choices = c("Bitcoin", "Ethereum", "Litecoin")),
numericInput("amount", "Amount of Cryptocurrency:", value = 1, min = 0),
numericInput("buyPrice", "Purchase Price per Unit (USD):", value = 0),
numericInput("sellPrice", "Selling Price per Unit (USD):", value = 0),
actionButton("calculate", "Calculate Tax")
),
mainPanel(
h3("Tax Calculation"),
verbatimTextOutput("result"),
DT::DTOutput("transactionTable")
)
)
)
)
)
)
)

Define Server logic

server <- function(input, output) {
output$transactionTable <- DT::renderDT({
datatable(data.frame(Currency = input$currency, Amount = input$amount, BuyPrice = input$buyPrice, SellPrice = input$sellPrice))
})

observeEvent(input$calculate, {
output$result <- renderText({
paste("Calculating for", input$currency)
})
})
}

Run the application

shinyApp(ui = ui, server = server)

  1. Steps Taken:
  • I created a minimal version of the app, which works fine.
  • Verified that the DT package is installed and loaded.
  • Used the DT:: prefix for all DT functions.
  • Checked the logs, which indicate the error related to DTOutput.
  1. Environment Details:
  • R version: 4.4.1
  • Shiny version: 1.9.1
  • DT version: 1.15
  1. Additional Information:
    This error occurs only when I deploy the app. It runs fine locally. The logs from the deployment show:

2024-09-12T15:27:48.059755+00:00 shinyapps[12680811]: Warning: Error in DTOutput: could not find function "DTOutput"

I would appreciate any insights or suggestions on how to resolve this issue!

Thank you!

The latest version of the DT package is 0.33 (2024-04-04). CRAN: Package DT

Make sure your local version of DT was installed from CRAN, then try a redeploy?