Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titlePrerequisites

It is recommended that you familiarise yourself with R first by sitting our Introduction to R tutorial.

It also requires that you have the DataSHIELD training environment installed on your machine, see our Installation Instructions for Linux, Windows, or Mac.


Tip
titleHelp

DataSHIELD support is freely available in the DataSHIELD forum by the DataSHIELD community. Please use this as the first port of call for any problems you may be having, it is monitored closely for new threads.

DataSHIELD bespoke user support and also user training classes are offered on a fee-paying basis. Please enquire at datashield@newcastle.ac.uk for current prices. 

...

The other parts in this DataSHIELD tutorial series are:

Quick reminder for logging in:

Recall from the installation instructions, the Opal web interface is a simple check to tell if the VMs have started. Load the following urls, waiting at least 1 minute after starting the training VMs.

  • http://192.168.56.100:8080 
  • http://192.168.56.101:8080 
    Expand

    Start R/RStudio

    Load Packages

    Code Block
    xml
    xml
    #load libraries
    library(DSI)
    library(DSOpal)
    library(dsBaseClient)
    

    Build your login dataframe 

    Code Block
    languagexml
    titleBuild your login dataframe
    builder <- DSI::newDSLoginBuilder()
    builder <- DSI::newDSLoginBuilder()
    builder$append(server = "study1server1",  url = "httphttps://192.168.56.100:8080/",
                  opal-demo.obiba.org/",
    user = "administratordsuser", password = "datashield_test&P@ssw0rd",                table driver = "CNSIM.CNSIM1OpalDriver", driver = "OpalDriver"options='list(ssl_verifyhost=0, ssl_verifypeer=0)')
    builder$append(server = "study2server2", url = "httphttps://192opal-demo.168.56.101:8080obiba.org/",
                  
    user = "administratordsuser", password = "datashield_test&P@ssw0rd", driver =              table = "CNSIM.CNSIM2", driver = "OpalDriver""OpalDriver", options='list(ssl_verifyhost=0, ssl_verifypeer=0)')
    
    logindata <- builder$build()
    
    logindata <- builder$build()
    
    connections <- DSI::datashield.login(logins = logindata, assign = TRUE)
    DSI::datashield.assign.table(conns = connections, symbol = "DST", "D"table = c("CNSIM.CNSIM1","CNSIM.CNSIM2"))
    • Command to logout:
    Code Block
    languagebash
    DSI::datashield.logout(connections)


    ...

    Code Block
    languagexml
    ds.log(x='D$LABDST$LAB_HDL', datasources = connections)
    

    ...

    Code Block
    themeRDark
      Aggregated (exists("DDST")) [=============================================================] 100% / 0s
      Aggregated (classDS("D$LABDST$LAB_HDL")) [====================================================] 100% / 1s
      Assigned expr. (log.newobj <- log(D$LABDST$LAB_HDL,2.71828182845905)) [=======================] 100% / 0s
      Aggregated (exists("log.newobj")) [====================================================] 100% / 0s

    ...

    Code Block
    languagexml
    ds.log(x='D$LABDST$LAB_HDL', newobj='LAB_HDL_log', datasources = connections)
    

    ...

    Code Block
    languagexml
    ds.assign(toAssign='D$LABDST$LAB_HDL-1.562', newobj='LAB_HDL.c', datasources = connections)

    ...

    Code Block
    languagexml
    ds.table(rvar="D$GENDERDST$GENDER")
    


    Code Block
    themeRDark
      Aggregated (asFactorDS1("D$GENDERDST$GENDER")) [=================================================] 100% / 0s
      Aggregated (tableDS(rvar.transmit = "D$GENDERDST$GENDER", cvar.transmit = NULL, stvar.transmit = NULL, ) ...
    
     Data in all studies were valid 
    
    Study 1 :  No errors reported from this study
    Study 2 :  No errors reported from this study
    
    $output.list
    $output.list$TABLE_rvar.by.study_row.props
            study
    D$GENDERDST$GENDER         1         2
           0 0.4079193 0.5920807
           1 0.4160839 0.5839161
    
    $output.list$TABLE_rvar.by.study_col.props
            study
    D$GENDERDST$GENDER         1         2
           0 0.5048544 0.5132772
           1 0.4951456 0.4867228
    
    $output.list$TABLE_rvar.by.study_counts
            study
    D$GENDERDST$GENDER    1    2
           0 1092 1585
           1 1071 1503
    
    $output.list$TABLES.COMBINED_all.sources_proportions
    D$GENDERDST$GENDER
       0    1 
    0.51 0.49 
    
    $output.list$TABLES.COMBINED_all.sources_counts
    D$GENDERDST$GENDER
       0    1 
    2677 2574 
    
    
    $validity.message
    [1] "Data in all studies were valid"

    ...

    Code Block
    languagexml
    ds.table(rvar='D$DISDST$DIS_DIAB', cvar='D$GENDERDST$GENDER', datasources = connections)

    ...

    Code Block
    themeRDark
      Aggregated (asFactorDS1("D$DISDST$DIS_DIAB")) [===============================================] 100% / 0s
      Aggregated (asFactorDS1("D$GENDERDST$GENDER")) [=================================================] 100% / 0s
      Aggregated (tableDS(rvar.transmit = "D$DISDST$DIS_DIAB", cvar.transmit = "D$GENDERDST$GENDER", ) [======] 100% / 0s
    
     Data in all studies were valid 
    
    Study 1 :  No errors reported from this study
    Study 2 :  No errors reported from this study
    
    $output.list
    $output.list$TABLE.STUDY.1_row.props
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB     0     1
             0 0.502 0.498
             1 0.700 0.300
    
    $output.list$TABLE.STUDY.1_col.props
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB      0      1
             0 0.9810 0.9920
             1 0.0192 0.0084
    
    $output.list$TABLE.STUDY.2_row.props
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB     0     1
             0 0.511 0.489
             1 0.660 0.340
    
    $output.list$TABLE.STUDY.2_col.props
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB      0      1
             0 0.9800 0.9890
             1 0.0196 0.0106
    
    $output.list$TABLES.COMBINED_all.sources_row.props
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB     0     1
             0 0.507 0.493
             1 0.675 0.325
    
    $output.list$TABLES.COMBINED_all.sources_col.props
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB      0       1
             0 0.9810 0.99000
             1 0.0194 0.00971
    
    $output.list$TABLE_STUDY.1_counts
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB    0    1
             0 1071 1062
             1   21    9
    
    $output.list$TABLE_STUDY.2_counts
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB    0    1
             0 1554 1487
             1   31   16
    
    $output.list$TABLES.COMBINED_all.sources_counts
              D$GENDERDST$GENDER
    D$DISDST$DIS_DIAB    0    1
             0 2625 2549
             1   52   25
    
    
    $validity.message
    [1] "Data in all studies were valid"

    ...

    The function can additionally compute a chi-squared test for homogeneity on (nc-1)*(nr-1) degrees of freedom (where nc is the number of columns and nr is the number of rows):


    Code Block
    languagexml
    ds.table(rvar='DST$DIS_DIAB', cvar='DST$GENDER', datasources = connections, report.chisq.tests = TRUE)

    Below code omits the first section of output which is an exact duplicate of above, only chisquare reports shown:

    ...

    The other parts in this DataSHIELD tutorial series are:

    Tip

    Also remember you can:

    ...