Skip to content

Instantly share code, notes, and snippets.

@talegari
Last active October 11, 2016 03:14
Show Gist options
  • Save talegari/d24cf744822d433406ec54808df59e34 to your computer and use it in GitHub Desktop.
Save talegari/d24cf744822d433406ec54808df59e34 to your computer and use it in GitHub Desktop.
###############################################################################
#
# R_packages_and_their_friends ----
# version: 1
#
###############################################################################
#
# author : Srikanth KS (talegari)
# license : GNU AGPLv3 (http://choosealicense.com/licenses/agpl-3.0/)
#
###############################################################################
# shiny app to quickly visualize the "neighbour"ing packages
library("shiny")
library("miniCRAN")
library("igraph")
# get the package repo metadata from CRAN
metaData <- pkgAvail()
pkgNames <- rownames(metaData)
server <- function(input, output) {
output$pkgGraph <- renderPlot({
dg <- makeDepGraph(input$pkgs
, availPkgs = metaData
, includeBasePkgs = input$includeBasePkgs
, suggests = input$suggests
, enhances = input$enhances
)
set.seed(100)
plot(dg
, main = NULL
, cex = input$cexValue
)
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
# multiselect for all possible packages
selectizeInput(inputId = "pkgs"
, label = "Select Packages (max of 5)"
, choices = pkgNames
, multiple = TRUE
, options = list(maxItems = 5)
, selected = "ggplot2"
)
, checkboxInput(inputId = "includeBasePkgs"
, label = "Include Base R Packages"
, value = FALSE
)
, checkboxInput(inputId = "suggests"
, label = "Include suggested packages"
, value = FALSE
)
, checkboxInput(inputId = "enhances"
, label = "Include enhanced packages"
, value = FALSE
)
, numericInput(inputId = "cexValue"
, label = "Change size (0.1 to 2)"
, value = 1
, min = 0.1
, max = 2
)
, p('----')
, a('code on github gist',href = 'https://gist.github.com/talegari/d24cf744822d433406ec54808df59e34#file-r_packages_and_their_friends-r')
)
, mainPanel(
titlePanel("R Packages and their friends")
, plotOutput("pkgGraph", height = 550))
)
)
shinyApp(ui = ui, server = server)
@talegari
Copy link
Author

talegari commented Oct 11, 2016

App deployed here: https://talegari.shinyapps.io/pkgVis
Its on free tier with limited hours, please do not abuse it. Run the code from gist instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment