diff --git a/R/DSLiteServer.R b/R/DSLiteServer.R index 5b0f7ea..2a8f10c 100644 --- a/R/DSLiteServer.R +++ b/R/DSLiteServer.R @@ -311,7 +311,11 @@ DSLiteServer <- R6::R6Class( #' @description List the names of the tables that can be assigned. tableNames = function() { - names(private$.tables) + if (length(private$.tables)) { + names(private$.tables) + } else { + vector(mode="character", length = 0) + } }, #' @description Check a table exists. @@ -322,7 +326,11 @@ DSLiteServer <- R6::R6Class( #' @description List the names of the resources (\code{resourcer::Resource} objects) that can be assigned. resourceNames = function() { - names(private$.resources) + if (length(private$.resources)) { + names(private$.resources) + } else { + vector(mode="character", length = 0) + } }, #' @description Check a resource (\code{resourcer::Resource} object) exists. diff --git a/inst/examples/datashield.R b/inst/examples/datashield.R index b490934..c2d362e 100644 --- a/inst/examples/datashield.R +++ b/inst/examples/datashield.R @@ -17,6 +17,12 @@ dslite.server$config() data("logindata.dslite.cnsim") conns <- datashield.login(logindata.dslite.cnsim, assign=T, variables=c("GENDER","PM_BMI_CONTINUOUS"), id.name="ID") +# list all available tables +datashield.tables(conns) + +# list all available resources +datashield.resources(conns) + # check assigned variables datashield.symbols(conns)