-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatashield-R.Rmd
More file actions
73 lines (54 loc) · 1.23 KB
/
datashield-R.Rmd
File metadata and controls
73 lines (54 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
title: "DataSHIELD Python/R Notebook"
output: html_notebook
---
1. Establish connections with DataSHIELD nodes
```{r}
library(DSOpal)
library(dsBaseClient)
builder <- DSI::newDSLoginBuilder()
builder$append(server = "study1", url = "https://opal-demo.obiba.org",
user = "dsuser", password = "P@ssw0rd",
profile = "default")
builder$append(server = "study2", url = "https://opal-demo.obiba.org",
user = "dsuser", password = "P@ssw0rd",
profile = "default")
logindata <- builder$build()
options(datashield.progress = FALSE)
conns <- DSI::datashield.login(logins = logindata)
```
2. Utility functions
List profiles:
```{r}
datashield.profiles(conns)
```
List packages:
```{r}
datashield.pkg_status(conns)
```
List allowed methods:
```{r}
datashield.method_status(conns, type = "aggregate")
```
3. Make analysis
```{r}
datashield.assign.table(conns, "df", list(
study1 = "CNSIM.CNSIM1",
study2 = "CNSIM.CNSIM2"))
```
```{r}
ds.colnames('df')
```
```{r}
ds.mean('df$LAB_GLUC_ADJUSTED')
```
```{r}
ds.heatmapPlot('df$LAB_TSC', 'df$LAB_HDL', type = 'split')
```
```{r}
ds.histogram('df$LAB_GLUC_ADJUSTED', type = 'split')
```
4. Clean up
```{r}
datashield.logout(conns)
```