임의로 생성 된 data.frame이 있습니다. 사용자는 슬라이더를 수정하여 포인트 수를 선택할 수 있습니다. 그런 다음이 data.frame을 그립니다.R Shiny : 데이터를 업데이트하는 버튼을 만듭니다. 프레임
클릭했을 때보 다 버튼을 추가하고 싶습니다. 이전 무작위로 생성 된 data.frame에서 수정을 수행합니다 (단, data.frame은 다시 생성하지 않음). 수정은 voronoid relaxation이며 버튼을 클릭 할 때마다 그래프를 생성해야합니다.
는 지금까지, 나는 ...
ui.R
을 아무것도 비슷한 달성하지library(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
# Application title
titlePanel("Map Generator:"),
# Sidebar with a slider input for the number of bins
sidebarLayout(
sidebarPanel(
p("Select the power p to generate 2^p points."),
sliderInput("NumPoints",
"Number of points:",
min = 1,
max = 10,
value = 9),
actionButton("GenPoints", "Generate"),
actionButton("LloydAlg", "Relaxe")
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot",height = 700, width = "auto")
)
)
))
server.R 내가 뭘해야 뭔가가 물론
library(shiny)
library(deldir)
shinyServer(function(input, output) {
observeEvent(input$NumPoints,{
x = data.frame(X = runif(2^input$NumPoints,1,1E6),
Y = runif(2^input$NumPoints,1,1E6))
observeEvent(input$LloydAlg, {
x = tile.centroids(tile.list(deldir(x)))
})
output$distPlot <- renderPlot({
plot(x,pch = 20,asp=1,xlim=c(0,1E6),ylim = c(0,1E6))
})
})
})
틀린,하지만 나는 아주 새롭다. 나는 내가 잘못하고있는 것을 알아낼 수 없다 ...