|
1 | 1 | #' |
2 | 2 | #' @title Computes the absolute values of a variable |
3 | | -#' @description Computes the absolute values for a specified numeric or integer vector. |
| 3 | +#' @description Computes the absolute values for a specified numeric or integer vector. |
4 | 4 | #' This function is similar to R function \code{abs}. |
5 | | -#' @details The function calls the server-side function \code{absDS} that computes the |
6 | | -#' absolute values of the elements of a numeric or integer vector and assigns a new vector |
7 | | -#' with those absolute values on the server-side. The name of the new generated vector is |
| 5 | +#' @details The function calls the server-side function \code{absDS} that computes the |
| 6 | +#' absolute values of the elements of a numeric or integer vector and assigns a new vector |
| 7 | +#' with those absolute values on the server-side. The name of the new generated vector is |
8 | 8 | #' specified by the user through the argument \code{newobj}, otherwise is named by default to |
9 | 9 | #' \code{abs.newobj}. |
10 | 10 | #' @param x a character string providing the name of a numeric or an integer vector. |
11 | 11 | #' @param newobj a character string that provides the name for the output variable |
12 | | -#' that is stored on the data servers. Default name is set to \code{abs.newobj}. |
13 | | -#' @param datasources a list of \code{\link[DSI]{DSConnection-class}} objects obtained after login. |
| 12 | +#' that is stored on the data servers. Default name is set to \code{abs.newobj}. |
| 13 | +#' @param datasources a list of \code{\link[DSI]{DSConnection-class}} objects obtained after login. |
14 | 14 | #' If the \code{datasources} argument is not specified the default set of connections will be |
15 | 15 | #' used: see \code{\link[DSI]{datashield.connections_default}}. |
16 | 16 | #' @return \code{ds.abs} assigns a vector for each study that includes the absolute values of |
|
22 | 22 | #' \dontrun{ |
23 | 23 | #' |
24 | 24 | #' # Connecting to the Opal servers |
25 | | -#' |
| 25 | +#' |
26 | 26 | #' require('DSI') |
27 | 27 | #' require('DSOpal') |
28 | 28 | #' require('dsBaseClient') |
29 | | -#' |
| 29 | +#' |
30 | 30 | #' builder <- DSI::newDSLoginBuilder() |
31 | | -#' builder$append(server = "study1", |
32 | | -#' url = "http://192.168.56.100:8080/", |
33 | | -#' user = "administrator", password = "datashield_test&", |
| 31 | +#' builder$append(server = "study1", |
| 32 | +#' url = "http://192.168.56.100:8080/", |
| 33 | +#' user = "administrator", password = "datashield_test&", |
34 | 34 | #' table = "CNSIM.CNSIM1", driver = "OpalDriver") |
35 | | -#' builder$append(server = "study2", |
36 | | -#' url = "http://192.168.56.100:8080/", |
37 | | -#' user = "administrator", password = "datashield_test&", |
| 35 | +#' builder$append(server = "study2", |
| 36 | +#' url = "http://192.168.56.100:8080/", |
| 37 | +#' user = "administrator", password = "datashield_test&", |
38 | 38 | #' table = "CNSIM.CNSIM2", driver = "OpalDriver") |
39 | 39 | #' builder$append(server = "study3", |
40 | | -#' url = "http://192.168.56.100:8080/", |
41 | | -#' user = "administrator", password = "datashield_test&", |
| 40 | +#' url = "http://192.168.56.100:8080/", |
| 41 | +#' user = "administrator", password = "datashield_test&", |
42 | 42 | #' table = "CNSIM.CNSIM3", driver = "OpalDriver") |
43 | | -#' |
| 43 | +#' |
44 | 44 | #' logindata <- builder$build() |
45 | | -#' |
| 45 | +#' |
46 | 46 | #' # Log onto the remote Opal training servers |
47 | | -#' connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D") |
48 | | -#' |
| 47 | +#' connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D") |
| 48 | +#' |
49 | 49 | #' # Example 1: Generate a normally distributed variable with zero mean and variance equal |
50 | 50 | #' # to one and then get their absolute values |
51 | 51 | #' ds.rNorm(samp.size=100, mean=0, sd=1, newobj='var.norm', datasources=connections) |
52 | 52 | #' # check the quantiles |
53 | 53 | #' ds.summary(x='var.norm', datasources=connections) |
54 | 54 | #' ds.abs(x='var.norm', newobj='var.norm.abs', datasources=connections) |
55 | 55 | #' # check now the changes in the quantiles |
56 | | -#' ds.summary(x='var.norm.abs', datasources=connections) |
| 56 | +#' ds.summary(x='var.norm.abs', datasources=connections) |
57 | 57 | #' |
58 | 58 | #' # Example 2: Generate a sequence of negative integer numbers from -200 to -100 |
59 | 59 | #' # and then get their absolute values |
60 | | -#' ds.seq(FROM.value.char = '-200', TO.value.char = '-100', BY.value.char = '1', |
| 60 | +#' ds.seq(FROM.value.char = '-200', TO.value.char = '-100', BY.value.char = '1', |
61 | 61 | #' newobj='negative.integers', datasources=connections) |
62 | 62 | #' # check the quantiles |
63 | 63 | #' ds.summary(x='negative.integers', datasources=connections) |
|
66 | 66 | #' ds.summary(x='positive.integers', datasources=connections) |
67 | 67 | #' |
68 | 68 | #' # clear the Datashield R sessions and logout |
69 | | -#' datashield.logout(connections) |
| 69 | +#' datashield.logout(connections) |
70 | 70 | #' |
71 | 71 | #' } |
72 | 72 | #' |
|
0 commit comments