Skip to content

Commit

Permalink
List resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ymarcon committed May 18, 2020
1 parent def4855 commit 451da70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions R/DSLiteServer.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions inst/examples/datashield.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 451da70

Please sign in to comment.