나는 이것이 당신이 찾고있는 것 같다. csv
파일에서 같은 데이터를로드했습니다.
autoFillDF <- structure(list(Name = c("ABC", "XYZ", "PQR"), Age = c(30L, 24L,
27L), Grade = c("A", "B", "D")), .Names = c("Name", "Age", "Grade"
), class = "data.frame", row.names = c(NA, -3L))
ui.R 코드
shinyUI(fluidPage(
titlePanel("Auto Fill"),
sidebarPanel(
selectizeInput("p1", choices = autoFillDF$Name, selected = NULL, label = 'Name'),
selectizeInput("p2", choices = NULL, label = 'Age'),
selectizeInput("p3", choices = NULL, label = 'Grade')
),
mainPanel(
DT::dataTableOutput('table')
)
)
)
server.R 코드 완벽한 답변을
autoFillDF <- read.csv('..../test.csv', stringsAsFactors = FALSE)
shinyServer(function(input, output, session) {
updateApp <- reactive({
data <- autoFillDF
data <- data[data$Name %in% input$p1,]
updateSelectizeInput(session, 'p2', choices = data$Age, selected = data$Age, server = TRUE)
updateSelectizeInput(session, 'p3', choices = data$Grade, selected = data$Grade, server = TRUE)
data
})
output$table <- DT::renderDataTable(
DT::datatable(updateApp())
)
})
감사합니다. 정말 문제를 해결합니다. –
@ElvinMitchellToro,이 답변으로 문제를 해결할 수 있다면 투표 화살표 아래의 체크 표시를 사용하여 [승인 된 것으로 표시] (https://stackoverflow.com/help/someone-answers)를 고려하십시오. – krish