diff --git a/inst/shiny/statnetWeb/global.R b/inst/shiny/statnetWeb/global.R index 1fd896c..9c5d1a9 100644 --- a/inst/shiny/statnetWeb/global.R +++ b/inst/shiny/statnetWeb/global.R @@ -35,22 +35,22 @@ inlineSelectInput <- function(inputId, label, choices, ...) { } # create a list of unique term names -splitargs <- function(searchterm, nw){ +# allow searching by string -- set to NULL to get search by nw attributes +splitargs <- function(string, nw){ sink("NUL") - allterms <- search.ergmTerms(keyword = searchterm, net = nw) + allterms <- search.ergmTerms(search = string, net = nw) sink() ind1 <- regexpr(pattern = "\\(", allterms) ind2 <- regexpr(pattern = "\\)", allterms) termnames <- substr(allterms, start = rep(1, length(allterms)), stop = ind1 - 1) termargs <- substr(allterms, start = ind1, stop = ind2) dups <- duplicated(termnames) - termargs <- termargs[-which(dups)] - termnames <- unique(termnames) + termnames <- termnames[!dups] + termargs <- termargs[!dups] list(names = termnames, args = termargs) } - # disable widgets when they should not be usable disableWidget <- function(id, session, disabled = TRUE) { if (disabled) { diff --git a/inst/shiny/statnetWeb/server.R b/inst/shiny/statnetWeb/server.R index 5ff053e..7399d52 100644 --- a/inst/shiny/statnetWeb/server.R +++ b/inst/shiny/statnetWeb/server.R @@ -22,7 +22,8 @@ histblue <- "#83B6E1" tgray3 <- adjustcolor("gray", alpha.f = 0.3) tgray7 <- adjustcolor("gray", alpha.f = 0.7) -allterms <- splitargs(searchterm = "") +# All ergm terms (no network or search terms passed) +allterms <- splitargs() shinyServer( function(input, output, session){