ds.rowColCalc {dsBaseClient}R Documentation

Computes sums and means of rows or columns of numeric matrix or data frame

Description

The function is similar to R base functions 'rowSums', 'colSums', 'rowMeans' and 'colMeans' with some restrictions.

Usage

ds.rowColCalc(x = NULL, operation = NULL, newobj = NULL,
  datasources = NULL)

Arguments

x

a character, the name of a matrix or a dataframe

operation

a character string which indicates the operation to carry out: "rowSums", "colSums", "rowMeans" or "colMeans".

newobj

the name of the new object. If this argument is set to NULL, the name of the new variable, set by default, is 'rowColCalc_out'.

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 results of calculation are not returned to the user if they are potentially revealing i.e. if the number of rows is less than the allowed number of observations.

Value

nothing is returned to the client, the new object is stored on the server side.

Author(s)

Gaye, A.

Examples

{

  # load that contains the login details
  data(logindata)

  # login and assign two variables
  myvar  <-  list("LAB_TSC","LAB_HDL")
  opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)

  # calculate the sum of each row of the above assigned dataset (default name 'D')
  ds.rowColCalc(x='D', operation='rowSums', newobj='rsum_D')

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

}

[Package dsBaseClient version 4.1.0 ]