``` {r setup, include=FALSE, cache=FALSE} devtools::load_all("~/Rbibliometricsdev/tidy_bibliometrics") library(DT) options(shiny.maxRequestSize=30*1024^2) options(width=10000)
```r fileInput("bibData", "Select a .bib file", accept=".bib") textInput("affil_separator", label="Affiliation Column Separator String", value="", width="100%") files_for_processing <- reactive({ input$bibData }) raw_data <- reactive({ read_files_shiny(c(files_for_processing()$datapath,files_for_processing()$name)) %>% convert2df_shiny() }) tidied_data <- reactive({ extract_affiliated_countries(set_separator(tidydf(raw_data())[[1]], "affiliation", input$affil_separator)) })
The file that was uploaded was r reactive(files_for_processing()$name)
. The following text is a series of pointless filler meant to stretch the width of the shiny widget displaying the coupling network.
checkboxGroupInput("columns_to_view", label="Toggle columns for viewing", choices=NULL, inline=TRUE, width="100%") mainPanel( DT::renderDataTable({ if ((!is.null(input$bibData)) && (!is.null(input$columns_to_view))){ tidied_data()[input$columns_to_view] } else { NULL } }), width=12 ) observe({ if (!is.null(input$bibData)){ updateCheckboxGroupInput(session, "columns_to_view", label="Toggle columns for viewing", choices=colnames(tidied_data()), inline=TRUE) } })
selectInput("target_col", label="Column for Network Analysis", choices=NULL, multiple=FALSE, width="100%") textInput("separator", label="Column Data Separator String", value="", width="100%") numericInput("row1", label="Row for start of Analysis", value=0, width="100%") numericInput("row2", label="Row for end of Analysis", value=0, width="100%") target_col_name <- reactive({ input$target_col }) sep <- reactive({ input$separator }) row1 <- reactive({ input$row1 }) row2 <- reactive({ input$row2 }) observe({ if (!is.null(input$bibData)){ updateSelectInput(session, "target_col", label="Column for Network Analysis", choices=colnames(tidied_data())) } })
get_nodes_edges_list <- reactive({ tidydf <- tidied_data() ultra_tidydf <- set_separator(tidydf, target_col_name(), sep()) network_analysis(ultra_tidydf, target_col_name(), row1(), row2()) }) fluidPage( visNetwork::renderVisNetwork({ if (!is.null(input$bibData)){ new_list <- get_nodes_edges_list() if (!is.null(new_list)){ visNetwork::visNetwork(new_list$nodes, new_list$edges) %>% visNetwork::visPhysics(solver="barnesHut", maxVelocity=10, barnesHut=list(damping=1, avoidOverlap=1, springLength=500)) %>% visNetwork::visEdges(smooth=TRUE) } else { NULL } } else { NULL } }), width=12 )
selectInput("target_col_for_analysis", label="Column for Summary", choices=NULL, multiple=FALSE, width="100%") textInput("separator_for_col", label="Column Data Separator String", value="", width="100%") target_col_for_summary <- reactive({ input$target_col_for_analysis }) sep_summary_col <- reactive({ input$separator_for_col }) observe({ if (!is.null(input$bibData)){ updateSelectInput(session, "target_col_for_analysis", label="Column for Summary", choices=colnames(tidied_data())) } }) get_summary <- reactive({ processed <- set_separator(tidied_data(), target_col_for_summary(), sep_summary_col()) col_analysis(processed, target_col_for_summary()) })
mainPanel( DT::renderDataTable({ if (!is.null(input$bibData)){ get_summary()[[2]] } else { NULL } }), width=12 )
mainPanel( DT::renderDataTable({ if (!is.null(input$bibData)){ get_summary()[[1]] } else { NULL } }), width=12 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.