![]() You build the output with a render*() function You save the output that you build to output$ The server function assembles inputs into outputs and follows 3 rules. Remember: the bins comes from how we named our input in the ui function of this project. A simple example is below with only a title and the histogram: Other histograms don't have to be as complex. The histogram is then drawn to the desired specifications. Bins is taking the variable x and setting the condition of the bins in this histogram. The variable x includes only the second column of faithful. The function after will include the code that builds the object: In order to access the input that we gave in the ui section of the app, we need to use input$ with what the input is named, in this case bins. renderText() creates a character string.renderDataTable() creates an interactive table.renderPlot() only creates a plot, while there are a variety of other functions for other types of outputs.You will build the objects to display using render*() functions.In this case, you would write output$distPlot because you saved the output as “distPlot” in the previous function. You save your objects to display using “output$”.When writing the server function, you need to follow 3 rules: The second section function(input, output) actually builds the output. The Output function adds space in the UI for an R object which we’ll build in the server function. The term plot determines the type of output that will be displayed (other types of outputs include tableOutput, imageOutput, and textOutput) and “distPlot” is the name given to the output object (you can name this whatever you want). To display the output, the function looks like plotOutput(“distPlot”). ![]() The format is a question mark, and then the input type which you are unsure about. If you’re unsure about how any of the functions work, you can type ?sliderInput for any additional information. The next item Number of bins: is the label that is displayed. The first item under sliderInput( ) is bins which is the name of the input. You can change the title, what type of input you want (numericInput( ), selectInput( ), and dateInput( ) are popular as well), and the elements within the input (like the minimum, maximum and preset values). ![]() The fluidPage contains both the input and output functions, for example, the titlePanel, sliderInput, and plotOutput. The first section fluidPage() contains the elements in the app. 8 Interactive Applications Using RShiny. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |