-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b2dd33
commit 9d06231
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |