Dear all,
we have some trouble using resources and ds.glm. If we run the same code on a ‘non-resource’, it works fine. Using resources, the glm gives an error message (“Command ‘glmDS1(D$KOLO_SCREEN ~ 1, “binomial”, NULL, NULL, NULL)’ failed on ‘test_resource’: Error while evaluating ‘dsBase::glmDS1(D$KOLO_SCREEN~1, “binomial”, NULL, NULL, NULL)’ → Error in glm.fit(x = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, : NA/NaN/Inf in ‘y’”).
The only difference seems to be the variable class, which changes to integer64. In the SQL database, the data is stored as BIGINT. The values on the server, which were extracted by the expression ds.unique, appear to be very small double values (e.g. 4.940656e-324), but the expected 0s and 1s are displayed by ds.table. Interestingly enough, if we add a line to change all 0s to 0s and all 1s to 1s, ds.glm works fine again. Is this representation intentional, or is there an error in our data upload? Other functions such as ds.table seem to convert somehow here? Can we enforce a class other than integer64?
We use Opal 5.0, MySQL 5.7, R 4.4.2, resourcer 1.4.0, dsBase 6.3.1, and dsTidyverse 1.0.4
Best,
Nadja
Our code is:
library(DSI) library(DSOpal) library(dsBaseClient) library(dsTidyverseClient) library(dsSurvivalClient) options(datashield.errors.print = TRUE) Sys.setenv(TZ=‘GMT’) Sys.setenv(ORA_SDTZ = ‘GMT’)
builder ← DSI::newDSLoginBuilder() builder$append(server = “”, url = “”, profile = ‘’, user = “”, password = “”, table = “”, options=“”) logindata ← builder$build()
connections ← DSI::datashield.login(logins = logindata, assign = TRUE, symbol = “resources”) datashield.assign.expr(connections, “D”, quote(as.resource.data.frame(resources, strict = TRUE)))
ds.table(‘D$KOLO_SCREEN’) ds.unique(‘D$KOLO_SCREEN’) cally ← paste0(“CHEATview(unique.newobj)”) DSI::datashield.aggregate(connections,as.symbol(cally))
glm1_fit = ds.glm(formula = D$KOLO_SCREEN ~ 1, family = ‘binomial’) ds.case_when(tidy_expr = list(D$KOLO_SCREEN == 1 ~ 1, D$KOLO_SCREEN == 0 ~ 0), newobj = “EXP”) glm1_fit = ds.glm(formula = EXP ~ 1, family = ‘binomial’)