Не удается напечатать python код на блестящей приборной панели R - PullRequest
1 голос
/ 03 февраля 2020

Я не уверен, что не так с кодом ниже. Я не могу запустить приведенный ниже python код файла ui.R .................................. ........


library(shiny)
library(shinydashboard)
library(reticulate)

ui <- dashboardPage(
    dashboardHeader(disable = TRUE),
    dashboardSidebar(disable = TRUE),
    dashboardBody(
        # Boxes need to be put in a row (or column)
        fluidRow(
            box(actionButton("upload","Upload",width = 150),
                actionButton("clear_upload","Clear",width = 150),
                verbatimTextOutput("code"))
        )
    )
)

server.R file

server <- function(input, output) {

    get_code <- eventReactive(input$upload,{
        py_run_string("def add(x, y):return x + (y+12)")
        py_run_string("print(add(5,1))")
    })

    observeEvent(input$upload, {
        output$code <- renderPrint(get_code())
        })

    observeEvent(input$clear_upload, {
        output$code <- renderPrint("")
        })
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...