view app.R @ 1:d52c39e8228a

経済のコアのオン/オフを追加
author uncorrelated zombie <uncorrelated@yahoo.co.jp>
date Thu, 27 Oct 2022 07:21:27 +0900
parents f7bf25ad338e
children 720ed4f3405a
line wrap: on
line source

library(shiny)
source("common.R")
source("EdgeworthBox.R")

loadLib("nleqslv", "shiny")

ui <- fluidPage(
    titlePanel("Edgeworth Box"),

    sidebarLayout(
        sidebarPanel(
            sliderInput("A",
                "initial amount of goods A of person 1",
                min = 0.01,
                max = 0.99,
                value = 0.8), 
            sliderInput("B",
                "initial amount of goods B of person 1",
                min = 0.01,
                max = 0.99,
                value = 0.3),
            checkboxInput("isI", "Initial Point", TRUE),
            checkboxInput("isE", "Equilibrium", TRUE),
            checkboxInput("isSHP", "Separating Hyperplane", TRUE),
            checkboxInput("isCore", "Core", TRUE),
            checkboxInput("isCC", "Contract Curve", TRUE)
        ), 

        mainPanel(
            plotOutput("distPlot")
        )
    )
)

server <- function(input, output) {
    output$distPlot <- renderPlot({
        drawEdgeworthBox(input$A, input$B, CC=input$isCC, SHP=input$isSHP, I=input$isI, E=input$isE, CORE=input$isCore)
    }, width=400, height=400)
}

app <- shinyApp(ui = ui, server = server)
runApp(app)