1
나는 데이터 프레임 (df)을 만들고 반짝이는 R의 첫 번째 행에 숫자를 채 웁니다. 이제 데이터의 각 가변 요소 인덱스를보고 싶습니다. 프레임을 드롭 다운 목록에 추가하십시오. 즉, 인덱스를 사용하여 열 이름 대신 요소를 선택하고 싶습니다. 나는 이것이 이상하게 보일지도 모른다는 것을 압니다. 그러나 저는 이것에 정말로 도움이 필요합니다. 내 예제 코드는 다음과 같습니다 :드롭 다운 목록에서 데이터 선택 R
**ui.R**
shinyUI(fluidPage(
titlePanel(""),
sidebarLayout(
sidebarPanel(
fileInput("file", "Upload the file",
accept=c('txt', 'text files', '.txt')),
tags$hr(style="padding:0px;margin:0px"),
selectInput(inputId = "table_no", label = "Select table", choices = "Pending Upload"),
),
**server.R**
shinyServer(function(input, output, session){
data <- reactive({
file1 <- input$file
if(is.null(file1)){return()}
dta <- read.csv(file1$datapath, header = TRUE, fill = TRUE)
trial <- 1:5
df <- data.frame(matrix(trial, ncol = length(trial), nrow = 1, byrow = TRUE), stringsAsFactors = FALSE)
colnames(df) <- paste("Table",trial)
selectInput
의 값이 문자열 그렇다고 당신 대신 당신이 R.의 열 인덱스에 의해 반짝의 유일한 차이 서브 세트를 수있는 동일한 방법입니다 열 이름의 인덱스를 사용할 수 있습니다
당신이 [재현 예]를 제공 할 수 있습니다 (HTTP : // 유래. com/questions/5963269/how-to-make-a-great-r-reproducible-example)은 무엇입니까? – jsb