Dear community,
I recently started to work with Datashield and ran into trouble using the ds.dataFrameSubset function within the DSLite framework.
Problem: For me, the function ds.dataFrameSubset returns the error “cannot coerce class ‘“function”’ to a data.frame” on all servers, if I use DSLite. However, when I use the servers from the virtual machines, as in the tutorials, the function works perfectly fine.
Reproduction of not working code
library(DSLite)
library(dsBaseClient)
logindata.dslite.cnsim <- setupCNSIMTest()
connections <- datashield.login(logindata.dslite.cnsim, assign=T)
ds.dataFrameSubset(df.name = "D", V1.name = "D$GENDER", V2.name = "1",
Boolean.operator = "==", newobj = "CNSIM.subset.Males",
datasources= connections)
Reproduction of working code (from the tutorial)
library(DSI)
library(DSOpal)
library(dsBaseClient)
builder <- DSI::newDSLoginBuilder()
builder$append(server = "server1", url = "http://192.168.56.100:8080/",
user = "administrator", password = "datashield_test&", driver = "OpalDriver")
builder$append(server = "server2", url = "http://192.168.56.101:8080/",
user = "administrator", password = "datashield_test&", driver = "OpalDriver")
logindata <- builder$build()
connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D")
DSI::datashield.assign.table(conns = connections, symbol = "D", table = c("CNSIM.CNSIM1","CNSIM.CNSIM2", "CNSIM.CNSIM3"))
ds.dataFrameSubset(df.name = "D", V1.name = "D$GENDER", V2.name = "1",
Boolean.operator = "==", newobj = "CNSIM.subset.Males",
datasources= connections)
Has someone experienced similar problems or has an idea what is going on? (It could definitely be a beginners mistake! )