Skip to content

Commit

Permalink
updated datashield example with dsBase
Browse files Browse the repository at this point in the history
  • Loading branch information
ymarcon committed Oct 6, 2022
1 parent 5fe20b3 commit f6af95e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions inst/examples/datashield.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#

library(DSLite)
library(dsBaseClient)

# prepare data in a light DS server
data("CNSIM1")
Expand All @@ -29,22 +30,25 @@ datashield.symbols(conns)

# table assignment can also happen later
datashield.assign(conns, "T", "CNSIM1", variables=c("GENDER"))
datashield.aggregate(conns,'classDS(T)')
ds.class("T")
ds.colnames("T")
ds.class("T$GENDER")

# execute some aggregate calls (if these methods are available in the conns)
datashield.aggregate(conns,'colnamesDS(D)')
datashield.aggregate(conns,quote(lengthDS(D$GENDER)))
ds.class("D")
ds.colnames("D")
ds.length("D$GENDER")

# clean symbols
datashield.rm(conns,'D')
datashield.symbols(conns)

# assign and aggregate arbitrary values
datashield.assign(conns, "x", quote(c("1", "2", "3")))
datashield.aggregate(conns,quote(lengthDS(x)))
datashield.aggregate(conns,'classDS(x)')
ds.length("x")
ds.class("x")
datashield.assign(conns, "xn", quote(as.numeric(x)))
datashield.aggregate(conns,'classDS(xn)')
ds.class("xn")

datashield.methods(conns, type="aggregate")
datashield.methods(conns$sim1, type="aggregate")
Expand Down

0 comments on commit f6af95e

Please sign in to comment.