Skip to content

Commit d228386

Browse files
committed
Fixes to reflect changes to 'namesDS'
1 parent 5d2c762 commit d228386

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

R/ds.summary.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ ds.summary <- function(x=NULL, datasources=NULL){
174174
if("list" %in% typ){
175175
for(i in 1:numsources){
176176
l <- DSI::datashield.aggregate(datasources[i], call('lengthDS', x))[[1]]
177-
elts <- DSI::datashield.aggregate(datasources[i], as.symbol(paste0('namesDS(', x, ')' )))[[1]]
177+
elts <- DSI::datashield.aggregate(datasources[i], call('namesDS', x))[[1]]
178178
if(is.null(elts)){
179179
stdsummary <- list('class'=typ, 'length'=l)
180180
}else{

tests/testthat/test-smk-ds.summary.R

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@ test_that("summary_factor_variable", {
6868
expect_equal(res$sim3$`count of '3'`, 1154)
6969
})
7070

71+
context("ds.summary::smk::summary of a list variable")
72+
ds.asList(x.name='D$PM_BMI_CATEGORICAL', newobj="a_list")
73+
res <- ds.summary(x='a_list')
74+
test_that("summary_list_variable", {
75+
expect_length(res, 3)
76+
expect_length(res$sim1, 2)
77+
expect_equal(res$sim1$class, "list")
78+
expect_equal(res$sim1$length, 2163)
79+
expect_length(res$sim2, 2)
80+
expect_equal(res$sim2$class, "list")
81+
expect_equal(res$sim2$length, 3088)
82+
expect_length(res$sim3, 2)
83+
expect_equal(res$sim3$class, "list")
84+
expect_equal(res$sim3$length, 4128)
85+
})
86+
7187
context("ds.summary::smk::summary of a data frame")
7288
res <- ds.summary(x='D')
7389
test_that("summary_data_frame", {
@@ -85,7 +101,7 @@ test_that("summary_data_frame", {
85101
context("ds.summary::smk::teardown")
86102

87103
test_that("shutdown", {
88-
ds_expect_variables(c("D", "a_character", "a_factor"))
104+
ds_expect_variables(c("D", "a_character", "a_factor", "a_list"))
89105
})
90106

91107
disconnect.studies.dataset.cnsim()

0 commit comments

Comments
 (0)