ds.dim {dsBaseClient}R Documentation

Retrieves the dimension of an object

Description

this function is similar to R function dim

Usage

ds.dim(x = NULL, type = "split", datasources = NULL)

Arguments

x

a character, the name of R table object, for example a matrix, array or data frame

type

a character which represents the type of analysis to carry out. If type is set to 'combine', a global variance is calculated .

datasources

a list of opal object(s) obtained after login in to opal servers; these objects hold also the data assign to R, as dataframe, from opal datasources.

Details

the function returns the unpooled or pooled dimension of the object by summing up the individual dimensions returned from each study or the dimension of the object in each study. Unlike the other DataSHIELD function the default behaviour is to output the dimension of each study separately.

Value

for an array, NULL or a vector of mode integer

Author(s)

Gaye, A.; Isaeva, J.

See Also

ds.dataframe to generate a table of type dataframe.

ds.changeRefGroup to change the reference level of a factor.

ds.colnames to obtain the column names of a matrix or a data frame

ds.asMatrix to coerce an object into a matrix type.

ds.length to obtain the size of a vector.

Examples

{

  # load that contains the login details
  data(logindata)

  # login and assign all the stored variables.
  opals <- datashield.login(logins=logindata,assign=TRUE)

  # Example 1: Get the dimension of the assigned datasets in each study
  ds.dim(x='D')

  # Example 2: Get the pooled dimension of the assigned datasets
  ds.dim(x='D', type='combine')

  # Example 2: Input has to be either matrix, data frame or an array
  # In the below example, the inpout is a vector so it will not work.
  ## Not run:  ds.dim(x='D$LAB_TSC') 

  # clear the Datashield R sessions and logout
  datashield.logout(opals)

}

[Package dsBaseClient version 4.1.0 ]