-
Notifications
You must be signed in to change notification settings - Fork 0
/
ds.retStr.R
67 lines (61 loc) · 2.27 KB
/
ds.retStr.R
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
#' @title Passes a string to a server-side environment
#' @description Passes a string to a server side environment and prints the string returned from the server.
#' @details This is a function to test writing new functions and the communication between the client and the server.
#'
#' Server function called: \code{retStrDS}.
#'
#' @param search.filter character string (potentially including \code{*} symbol without spaces)
#' specifying the string that you want to pass to the server-side.
#' For more information see \strong{Details}.
#' @return \code{ds.retStr} returns to the client-side a string
#' @author Soumya Banerjee, 2020
#' @examples
#' \dontrun{
#'
#' ## Version 6
#'
#' # connecting to the Opal servers
#'
#' require('DSI')
#' require('DSOpal')
#' require('dsBaseClient')
#'
#' builder <- DSI::newDSLoginBuilder()
#' builder$append(server = "study1",
#' url = "http://192.168.56.100:8080/",
#' user = "administrator", password = "datashield_test&",
#' table = "CNSIM.CNSIM1", driver = "OpalDriver")
#' builder$append(server = "study2",
#' url = "http://192.168.56.100:8080/",
#' user = "administrator", password = "datashield_test&",
#' table = "CNSIM.CNSIM2", driver = "OpalDriver")
#' builder$append(server = "study3",
#' url = "http://192.168.56.100:8080/",
#' user = "administrator", password = "datashield_test&",
#' table = "CNSIM.CNSIM3", driver = "OpalDriver")
#' logindata <- builder$build()
#'
#' connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D")
#'
#' ds.retStr('hello')
#'
#' # clear the Datashield R sessions and logout
#' datashield.logout(connections)
#' }
#'
#' @export
ds.retStr <- function(search.filter=NULL)
{
datasources <- datashield.connections_find()
# call the server side function
cat("On client side: \n")
calltext <- call("retStrDS",search.filter=search.filter)
cat("\n Class of calltext\n")
cat(class(calltext))
cat("\n What is in calltext ? \n")
cat(as.character(calltext))
cat("\n End of function \n")
output <- datashield.aggregate(datasources, calltext)
return(output)
}
#ds.retStr