शुरू करेंमुफ़्त में शुरू करें

एक टेक्स्ट फ़ाइल अपलोड करें (ui)

यदि टेक्स्ट बहुत लंबा हो, तो बॉक्स में टाइप करने के बजाय टेक्स्ट फ़ाइल अपलोड करना अधिक सुविधाजनक होता है.

Shiny ऐप में फ़ाइलें अपलोड करने के लिए fileInput() का उपयोग किया जाता है.

यह अभ्यास पाठ्यक्रम का हिस्सा है

केस स्टडीज़: R में Shiny के साथ वेब एप्लिकेशन बनाना

पाठ्यक्रम देखें

अभ्यास निर्देश

Shiny ऐप में एक फ़ाइल इनपुट जोड़ें जिसका input ID "file" और लेबल "Select a file" हो.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

ui <- fluidPage(
  h1("Word Cloud"),
  sidebarLayout(
    sidebarPanel(
      textAreaInput("text", "Enter text", rows = 7),
      # Add a file input
      ___,
      numericInput("num", "Maximum number of words",
                   value = 100, min = 5),
      colourInput("col", "Background color", value = "white")
    ),
    mainPanel(
      wordcloud2Output("cloud")
    )
  )
)

server <- function(input, output) {
  output$cloud <- renderWordcloud2({
    create_wordcloud(input$text, num_words = input$num,
                     background = input$col)
  })
}

shinyApp(ui = ui, server = server)
कोड संपादित करें और चलाएँ