I have a shiny Application which has a navigation List to the Left , I am having issues with the User Interface file in which i try to change the Navigation list to tabsets , But the below code does it for all the entire tabs that are present in shiny , But i want to choose a specific side tab in this case "Word Network " and want plot1 and plot 2 coded below should be shown only in this navigation and not other .
navlistPanel(
tabPanel("Introduction",
fluidRow(h3("Introduction",align="center"),tags$img(src="TextAnalytics.jpg",height=300,width=600),align="center"),
value=11,verbatimTextOutput("introduction")),
#tags$img(src="TextAnalytics.jpg",height=800,width=800),
tabPanel("Upload the File",fileInput("data1",label=("Upload the Unstructured Textual data To be analysed"))),
tabPanel("structure",value=1,verbatimTextOutput("str")),
tabPanel("data",value=2,tableOutput("data")),
tabPanel("Summary",value=3,verbatimTextOutput("summary")),
tabPanel("Word Cloud",value=4,plotOutput("plot",width=1000,height=600)),
tabPanel("Sentiment Analysis",value=5,plotOutput("plot2",width=1000,height=600)),
tabPanel("Topic Modelling",value=6,plotOutput("plot3",width=1000,height=600)),
#tabPanel("Word Frequency",value=7,plotOutput("plot4",width=1000,height=800)),
tabsetPanel(
tabPanel("plot1",value = 11),
tabPanel("plot2",value = 11)
),
tabPanel("Hierarchial Clustering",value=8,plotOutput("graph1",width=1500,height=h)),
tabPanel("Correlation Analysis",value=9,plotOutput("corelation",width=1000,height=1000)),
tabPanel("Word Network",value=10,plotOutput("graph2",width=1000,height=600)),
tabPanel("Community Detection",value=12,plotOutput("democommunity",width=1000,height=600)),
id="tabselected"
)
)
Related
I an using rpivotTable in a Shiny app
in UI it is inside a tabSetPanel:
tabPanel("Pivot Table",
shinycssloaders::withSpinner(
rpivotTableOutput("pivot_table")
)
)
in Server it is updated once the dataframe is loaded and filtered:
output$pivot_table <- renderRpivotTable({
rpivotTable(data = filtered_df(), rows=c("HIGH_LEVEL_GROUP_TERM", "HIGH_LEVEL_TERM", "AE_AS_PREFERRED_TERM"),
vals = "SAPPHIRE_CASE_ID_VERSION", aggregatorName = "Count Unique Values", rendererName = "Heatmap", width="100%")
})
When I scroll down the page, anything not observable immediately seems to have black on the outside of the pivot table?
I am using "shinydashboard"....
library(flexdashboard)
library(tidycensus)
library(tidyverse)
library(mapview)
library(dplyr)
library(tigris)
library(leafsync)
library(leafpop)
library(readxl)
library(DT)
library(highcharter)
{r}
#Importing Data ****Update file path before running****
states=data.frame(read_excel('C:/Users/pmckercher/Documents/CISA Research/CISA Funding Data.xlsx',
sheet = 'Funding By State',col_names = TRUE ))
us_geo=tigris::states(cb=FALSE, resolution = '20m') #State Sahpe File Download
all_data=inner_join(us_geo,states, by=c("NAME"="State")) #Joinging the two datasets
# These are shells, replace zcol= '' with a percentage of use column (will have to
#update the python file to calculate this when we get the real data) to make the display
#show how much of each states allocation has been provided.
Map22=mapview(all_data,zcol=c('fund_22'),col.regions = RColorBrewer::brewer.pal(11, "RdYlGn"), alpha.regions = 1, popup= popupTable(all_data,zcol=c('NAME', 'fund_22','fund_23','fund_24','fund_25')), label=c('NAME'))
Map22
This produces this visualization in the viewer:
Mapview Interactive Map
But, when the Dashaboard window pops up. it produces this where the map should be:
Buffering bars
How do I get the Interactive map to show up in the Dashboard window?
I've built a Shiny dashboard app that shows a number of metrics data of scientific articles by university School. The app is at https://ttso.shinyapps.io/2amconf and the code https://gist.github.com/tts/900b4e27bf37e8969ebd with some sample data of file dataforcharts.csv which is the data source of my question here.
My problem is the NVD3 chart on the landing tab.
At first it draws OK the selected max 2 items (=articles) from the chosen School, which is All at the beginning. But whenever I select some School - and selectizeInput then updates the list of items of that School - nothing happens.
I've tried to debug what's going on.
validate(
need(!is.null(itemsData()), "Please select some items")
)
dataC <- itemsData()
browser()
When the execution stops there, I can see that dataC do contains the chosen data.
Console utput of options(shiny.trace=TRUE) is talkative but I cannot really understand what it tries to tell me. Here's a snippet from the last message when the chart ought to render with new data, but does not.
SEND {"errors":[],"values":{"chart":"<style>.rChart {width: 800px;
height: 400px} </style>\n<script type='text/javascript'>\n
$(document).ready(function(){\n drawchart()\n });\n
function drawchart(){ \n var opts = {\n \"dom\":
\"chart\",\n\"width\": 800,\n\"height\": 400,\n\"x\":
\"id\",\n\"y\": \"value\",\n\"group\": \"variable\",\n\"type\":
\"multiBarChart\",\n\"id\": \"chart\" \n},\n data =
[ TEXT CUT OFF ] drawchart(){ \n n return chart;\n
});\n };\n</script>"},"inputMessages":[]}
Again, data= includes the correct, chosen data.
Is something wrong with my reactive values?
EDIT after observation: if I delete all selected item(s) before switching to another School, this works.
So, after some trial & error, this looks promising:
itemsData <- reactive({
if( is.null(input$items) ){
return(NULL)
}
isolate(selectedSchoolData()[selectedSchoolData()$Title %in%
input$items, ])
})
but I haven't yet got my head over isolate() so if someone could explain, why this works, I'd be grateful.
I decided to go with this.
itemsData <- reactive({
if( is.null(input$items) ){
return(NULL)
}
isolate(selectedSchoolData()[selectedSchoolData()$Title %in%
input$items, ])
})
I try to use the interactive plot, esp. click functionality to identify points in a plot. While it works fine with base plot, it doesn't identify the coordinates correctly in lattice::xyplot, thus failing to return the appropriate row from the data.frame.
A simple example:
library(shiny)
library(latticeExtra)
ui=shinyUI(fluidPage(
plotOutput("plot",click="plot_click"),
fluidRow(
column(4,verbatimTextOutput("click_info")),
column(4,verbatimTextOutput("click_pt"))
)
)
)
server=shinyServer(function(input,output){
output$plot=renderPlot(xyplot(NOx~C,data=ethanol)) # this fail
# output$plot=renderPlot(plot(NOx~C,data=ethanol)) # this works
output$click_info=renderPrint(input$plot_click)
output$click_pt=renderPrint(nearPoints(ethanol,input$plot_click,"C","NOx"))
})
shinyApp(ui=ui,server=server)
A perhaps remotely related post is this.
Any help?
I developed a Shiny App with RStudio that takes input, performs a search of a look-up table, and then returns a value. The search is not supposed to be performed until the user hits the submit button. However, upon launch, the App automatically performs and returns the first set of values from the lookup table. After this initial search, the app works exactly as expected. Is it possible to suppress this initial search (or have a default value) and perform the search ONLY when the submit button is pressed? I can't present reproducible code, but here is the structure of my input (server.R) and my user-interface (ui.R) code:
#server.R snippet
output$Word <- renderText({
predictWord <- input$gram
predict.function(predictWord) #User-defined function in global.r file
})
#ui.R snippet
tabPanel("Word Prediction",
sidebarPanel(
textInput("gram", "Enter up to three words"),
submitButton("Predict")),
mainPanel(
h4("Word Prediction"),
textOutput("predictWord")))
One way would be to substitute actionButton in place of submitButton and wrap whichever component in an if statement. Here is a simple example to display a number only slightly modified from the Shiny Widget Gallery.
require(shiny)
runApp(list(
ui = pageWithSidebar(
headerPanel("actionButton test"),
sidebarPanel(
numericInput("n", "N:", min = 0, max = 100, value = 50),
br(),
actionButton("goButton", "Go!"),
p("Click the button to update the value displayed in the main panel.")
),
mainPanel(
verbatimTextOutput("nText")
)
),
server = function(input, output){
output$nText <- renderText({
# Take a dependency on input$goButton
if(input$goButton >= 1){
# Use isolate() to avoid dependency on input$n
isolate(input$n)
}
})
}
)
)