To store the assigned data in the Armadillo service, you can use workspaces to make sure a certain state of the data is maintained on the service.
Saving the workspaces can be done during datashield.logout
or at runtime.
library(dsBaseClient) library(DSMolgenisArmadillo) # specify server url armadillo_url <- "https://armadillo-demo.molgenis.net/" # get token from central authentication server token <- armadillo.get_token(armadillo_url)
## [1] "We're opening a browser so you can log in with code R8VPYX"
# build the login dataframe builder <- DSI::newDSLoginBuilder() builder$append(server = "armadillo", url = armadillo_url, token = token, table = "gecko/2_1-core-1_0/nonrep", driver = "ArmadilloDriver") # create loginframe logindata <- builder$build() conns <- DSI::datashield.login(login = logindata)
## ## Logging into the collaborating servers
## [-------------------------------------------------------------------------------------] 0% / 0s Login armadillo [==================================>-----------------------------------] 50% / 0s Logged in all servers [================================================================] 100% / 0s
datashield.assign.table(conns = conns, table = "gecko/2_1-core-1_0/nonrep", symbol = "J", variables = c("recruit_age", "child_id"))
## [-------------------------------------------------------------------------------------] 0% / 0s Checking armadillo (J <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (J <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (J <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (J <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (J <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (J <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (J <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (J <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (J <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Finalizing assignment armadillo (J <- `gecko/2_1-core-1_0/nonrep`) [=========>---------] 50% / 0s Assigned all table (J <- ...) [========================================================] 100% / 0s
datashield.logout(conns, save = "my-workspace")
## [-------------------------------------------------------------------------------------] 0% / 0s Logout armadillo [=================================>-----------------------------------] 50% / 0s Logged out from all servers [==========================================================] 100% / 0s
conns <- DSI::datashield.login(logins = logindata, assign = FALSE, restore = "my-workspace")
## ## Logging into the collaborating servers ## [-------------------------------------------------------------------------------------] 0% / 0s Login armadillo [==================================>-----------------------------------] 50% / 0s Logged in all servers [================================================================] 100% / 0s
datashield.symbols(conns)
## $armadillo ## [1] "J"
datashield.workspace_save(conns, "my-workspace-version-2")
You can overwrite workspaces using the same name again when saving the workspace.
datashield.logout(conns)
## [-------------------------------------------------------------------------------------] 0% / 0s Logout armadillo [=================================>-----------------------------------] 50% / 0s Logged out from all servers [==========================================================] 100% / 0s
conns <- DSI::datashield.login(logins = logindata)
## ## Logging into the collaborating servers ## [-------------------------------------------------------------------------------------] 0% / 0s Login armadillo [==================================>-----------------------------------] 50% / 0s Logged in all servers [================================================================] 100% / 0s
datashield.assign.table(conns = conns, table = "gecko/2_1-core-1_0/nonrep", symbol = "H")
## [-------------------------------------------------------------------------------------] 0% / 0s Checking armadillo (H <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (H <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (H <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (H <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (H <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (H <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (H <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Waiting... (H <- ...) [---------------------------------------------------------------] 0% / 0s Checking armadillo (H <- `gecko/2_1-core-1_0/nonrep`) [--------------------------------] 0% / 0s Finalizing assignment armadillo (H <- `gecko/2_1-core-1_0/nonrep`) [=========>---------] 50% / 0s Assigned all table (H <- ...) [========================================================] 100% / 0s
datashield.workspace_save(conns, "my-workspace-overwritten") datashield.workspace_save(conns, "my-workspace-overwritten")
You can list the workspaces as well.
datashield.workspaces(conns$armadillo)
## name size lastAccessDate user ## 1 armadillo:my-workspace-overwritten 172073 2023-10-24T09:22:41.747Z ## 2 armadillo:my-workspace 3611 2023-10-24T09:22:40.615Z ## 3 armadillo:my-workspace-version-2 3611 2023-10-24T09:22:40.847Z
Remove workspaces.
datashield.workspace_rm(conns, "my-workspace-overwritten") datashield.workspaces(conns)
## server name..armadillo.my.workspace. name..armadillo.my.workspace.version.2. user ## 1 armadillo armadillo:my-workspace armadillo:my-workspace-version-2 ## 2 armadillo armadillo:my-workspace armadillo:my-workspace-version-2 ## lastAccessDate..2023.10.24T09.22.40.615Z. lastAccessDate..2023.10.24T09.22.40.847Z. size.3611L size.3611L.1 ## 1 2023-10-24T09:22:40.615Z 2023-10-24T09:22:40.847Z 3611 3611 ## 2 2023-10-24T09:22:40.615Z 2023-10-24T09:22:40.847Z 3611 3611
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.