Error when assigning table

Dear all,

wenn I want to assign the complete table (#connections <- DSI::datashield.login(logins = logindata, assign = TRUE)), I get the following error:

Error in names(x) <- value : ‘names’ attribute [6] must be the same length as the vector [0]

The upload in the site looks normal and the login works for other sites. Has anyone an idea what I should check?

Best, Daniela

Hi,

Would it be that this table has “repeatable” variables (several values per participant)?

Try to explicitly put the row identifiers in a separate column (and not as data.frame’s row names):

connections <- datashield.login(logins=logindata, assign=TRUE, id.name="ID")
ds.colnames("D")

Regards
Yannick

Hi Yannick,

no, only one line per individual.

Your code suggestion results in the same error.

Best, Daniela

Hi Daniela,

Ok, so it is not a problem related to the data.frame row names. It was not clear to me at first, but now I understand that what you are reporting is a client side problem, more specifically in the datashield.login function.

Could you try a code like this:

library(DSOpal)

builder <- newDSLoginBuilder()
# append your logindata information
logindata <- builder$build()

# connect, without assignment
conns <- datashield.login(logins=logindata, assign = FALSE)
# check whether tables exists and assignable
datashield.table_status(conns, logindata)
# close
datashield.logout(conns)

Regards
Yannick

Hi Yannick,

thanks for you help!

Here is the result:

connections <- DSI::datashield.login(logins = logindata, assign = FALSE)

Logging into the collaborating servers Logged in all servers [================================================================] 100% / 1s

datashield.table_status(connections, logindata)

    server      table                       accessible
 1 Frankfurt    projectname.tablename       TRUE

Best, Daniela

Hum that is not very helpful…

Let’s use rlang package to debug. If it is not already installed, please install it.

Then, before your code add this:

options(error = rlang::entrace)

Run your code until it fails. Then execute this:

rlang::last_trace()

And please report the output of the trace.

Yannick

Here is the result:

rlang::last_trace()

<error/rlang_error>

Error in names(x) <- value : ‘names’ attribute [6] must be the same length as the vector [0]

Backtrace:

  1. └─DSI::datashield.login(logins = logindata, assign = TRUE)
  2. └─DSI:::assignTables()
  3. └─DSI::datashield.method_status(rconnections, type = "aggregate")
    
  4.   └─base::lapply(...)
    
  5.     └─DSI:::FUN(X[[i]], ...)
    
  6.       ├─DSI::dsListMethods(c, type)
    
  7.       └─DSOpal::dsListMethods(c, type)
    
  8.         └─DSOpal:::.datashield.methods(o, type)
    
  9.           └─opalr::dsadmin.get_methods(opal, type)
    
  10.             └─base::`colnames<-`(...)

Ok I can reproduce it: the DataSHIELD configuration is missing on the server. Please make sure that expected R packages are installed (dsBase) and the aggregation/assign functions are published.

You can verify with:

conns <- datashield.login(logins=logindata, assign = FALSE)
datashield.method_status(conns, type = 'aggregate')
datashield.logout(conns)

I will strengthen the opalr code for this case.

Yannick

Hi Yannick,

thanks! I will contact the site and hope thats the issue!

Best, Daniela