Skip to content

Commit 43473be

Browse files
Merge branch 'datashield:v7.0-dev' into v7.0-dev
2 parents 145ae1e + 020b172 commit 43473be

24 files changed

Lines changed: 124 additions & 1435 deletions

.Rbuildignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
^R/secure.global.ranking.md$
1818
^_pkgdown\.yml$
1919
^docs$
20-
^dsBase_6.3.5.tar.gz$
21-
^dsBase_6.3.5-permissive.tar.gz$
20+
^dsBase_7.0-dev-feat_performance\.tar\.gz$
21+
^dsBase_7.0-dev-feat_performance-permissive\.tar\.gz$
2222
^dsDanger_6.3.4.tar.gz$
2323
^\.circleci$
2424
^\.circleci/config\.yml$

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export(ds.rBinom)
8989
export(ds.rNorm)
9090
export(ds.rPois)
9191
export(ds.rUnif)
92-
export(ds.ranksSecure)
9392
export(ds.rbind)
9493
export(ds.reShape)
9594
export(ds.recodeLevels)

R/ds.colnames.R

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
#'
22
#' @title Produces column names of the R object in the server-side
3-
#' @description Retrieves column names of an R object on the server-side.
3+
#' @description Retrieves column names of an R object on the server-side.
44
#' This function is similar to R function \code{colnames}.
5-
#' @details The input is restricted to the object of type \code{data.frame} or \code{matrix}.
6-
#'
5+
#' @details The input is restricted to the object of type \code{data.frame} or \code{matrix}.
6+
#'
77
#' Server function called: \code{colnamesDS}
88
#' @param x a character string providing the name of the input data frame or matrix.
9-
#' @param datasources a list of \code{\link[DSI]{DSConnection-class}} objects obtained after login.
9+
#' @param datasources a list of \code{\link[DSI]{DSConnection-class}} objects obtained after login.
1010
#' If the \code{datasources} argument is not specified
1111
#' the default set of connections will be used: see \code{\link[DSI]{datashield.connections_default}}.
12-
#' @return \code{ds.colnames} returns the column names of
13-
#' the specified server-side data frame or matrix.
12+
#' @return \code{ds.colnames} returns the column names of
13+
#' the specified server-side data frame or matrix.
1414
#' @author DataSHIELD Development Team
1515
#' @seealso \code{\link{ds.dim}} to obtain the dimensions of a matrix or a data frame.
16-
#' @examples
16+
#' @examples
1717
#' \dontrun{
18-
#'
18+
#'
1919
#' ## Version 6, for version 5 see the Wiki
2020
#' # Connecting to the Opal servers
21-
#'
21+
#'
2222
#' require('DSI')
2323
#' require('DSOpal')
2424
#' require('dsBaseClient')
25-
#'
25+
#'
2626
#' builder <- DSI::newDSLoginBuilder()
27-
#' builder$append(server = "study1",
28-
#' url = "http://192.168.56.100:8080/",
29-
#' user = "administrator", password = "datashield_test&",
27+
#' builder$append(server = "study1",
28+
#' url = "http://192.168.56.100:8080/",
29+
#' user = "administrator", password = "datashield_test&",
3030
#' table = "CNSIM.CNSIM1", driver = "OpalDriver")
31-
#' builder$append(server = "study2",
32-
#' url = "http://192.168.56.100:8080/",
33-
#' user = "administrator", password = "datashield_test&",
31+
#' builder$append(server = "study2",
32+
#' url = "http://192.168.56.100:8080/",
33+
#' user = "administrator", password = "datashield_test&",
3434
#' table = "CNSIM.CNSIM2", driver = "OpalDriver")
3535
#' builder$append(server = "study3",
36-
#' url = "http://192.168.56.100:8080/",
37-
#' user = "administrator", password = "datashield_test&",
36+
#' url = "http://192.168.56.100:8080/",
37+
#' user = "administrator", password = "datashield_test&",
3838
#' table = "CNSIM.CNSIM3", driver = "OpalDriver")
3939
#' logindata <- builder$build()
40-
#'
40+
#'
4141
#' # Log onto the remote Opal training servers
42-
#' connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D")
43-
#'
42+
#' connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D")
43+
#'
4444
#' # Getting column names of the R objects stored in the server-side
4545
#' ds.colnames(x = "D",
4646
#' datasources = connections[1]) #only the first server ("study1") is used
4747
#' # Clear the Datashield R sessions and logout
48-
#' datashield.logout(connections)
48+
#' datashield.logout(connections)
4949
#' }
5050
#' @export
5151
#'
@@ -65,6 +65,17 @@ ds.colnames <- function(x=NULL, datasources=NULL) {
6565
stop("Please provide the name of a data.frame or matrix!", call.=FALSE)
6666
}
6767

68+
# check if the input object(s) is(are) defined in all the studies
69+
defined <- isDefined(datasources, x)
70+
71+
# call the internal function that checks the input object is of the same class in all studies.
72+
typ <- checkClass(datasources, x)
73+
74+
# if the input object is not a matrix or a dataframe stop
75+
if(!('data.frame' %in% typ) & !('matrix' %in% typ)){
76+
stop("The input vector must be of type 'data.frame' or a 'matrix'!", call.=FALSE)
77+
}
78+
6879
cally <- call("colnamesDS", x)
6980
column_names <- DSI::datashield.aggregate(datasources, cally)
7081

0 commit comments

Comments
 (0)