Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Commit

Permalink
'data' added and internal function 'checkClass' added.
Browse files Browse the repository at this point in the history
  • Loading branch information
agaye committed Jul 11, 2014
1 parent 984513a commit 96c4aa7
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
23 changes: 23 additions & 0 deletions R/checkClass.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#'
#' @title Checks that an object has the same class in all studies
#' @description This is an internal function.
#' @details In DataSHIELD an object included in analysis must be of the same type in all
#' the collaborating studies. If that is not the case the process is stopped
#' @param datasources a list of opal object(s) obtained after login in to opal servers;
#' these objects hold also the data assign to R, as \code{dataframe}, from opal datasources.
#' @param obj a string charcater, the name of the object to check for.
#' @keywords internal
#' @return a message or the class of the object if the object has the same class in all studies.
#'
checkClass <- function(datasources=NULL, obj=NULL){
# check the class of the input object
cally <- paste0("class(", obj, ")")
objtype <- unique(unlist(datashield.aggregate(datasources, cally)))
if(length(objtype) > 1){
message("The input data is not of the same class in all studies!")
message("Use the function 'ds.class' to verify the class of the input object in each study.")
stop(" End of process!", call.=FALSE)
}else{
return(objtype)
}
}
Binary file added data/logindata.rda
Binary file not shown.
31 changes: 31 additions & 0 deletions man/checkClass.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
\name{checkClass}
\alias{checkClass}
\title{Checks that an object has the same class in all studies}
\usage{
checkClass(datasources = NULL, obj = NULL)
}
\arguments{
\item{datasources}{a list of opal object(s) obtained
after login in to opal servers; these objects hold also
the data assign to R, as \code{dataframe}, from opal
datasources.}

\item{obj}{a string charcater, the name of the object to
check for.}
}
\value{
a message or the class of the object if the object has the
same class in all studies.
}
\description{
This is an internal function.
}
\details{


In DataSHIELD an object included in analysis must be of the
same type in all the collaborating studies. If that is not
the case the process is stopped
}
\keyword{internal}

29 changes: 29 additions & 0 deletions man/logindata.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
\name{logindata}

\alias{logindata}

\docType{data}

\title{Information required to login to opal servers}

\description{
A table of with 5 columns: study name, URL, username, password and opal datasource.
}

\usage{data(logindata)}

\format{
A data frame where the number of servers corresponds to the number of rows
\describe{
\item{\code{server}}{a character, the formal name of the study}
\item{\code{url}}{URL of the opal server}
\item{\code{user}}{a character, a formal username or a
path to a valid ssl certificate, if required}
\item{\code{password}}{a character, a formal password or a
path to a valid ssl key if required}
\item{\code{table}}{a character, the path to the opal datasource that holds the data
to analyse}
}
}

\examples{data(logindata)}

0 comments on commit 96c4aa7

Please sign in to comment.