dssSubsetByClass: Subset any number of vectors and/or dataframes by the levels...

Description Usage Arguments Value Examples

Description

Alternative to the datashield function ds.SubsetByClass

Usage

1
2
3
4
5
6
7
8
9
dssSubsetByClass(
  x,
  subsets = "subClasses",
  variables = NULL,
  keep.cols = NULL,
  async = TRUE,
  wait = TRUE,
  datasources = NULL
)

Arguments

x

a vector containing one or more names of vectors or dataframes present on the remote nodes

subsets

a character, name of the new list containing the subsets - default "subClasses"

variables

a vector containing one or more names of dataframe columns or standalone factors by which to subset

keep.cols

a vector containing the names of the columns or vectors to keep in the result (by default all are kept)

async

same as in datashield.assign

wait

same as in datashield.assign

datasources

same as in datashield.assign

Value

It doesn't return anything of value, it creates a list containing dataframes (as many as the combinations of categories of "variables") on each node

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# open a local pseudo connection:
opals <-  dssCreatePseudoServers('test', servers = 1)
# load iris and create a vector and a factor:
datashield.aggregate(opals['local1'], as.symbol('partialData("iris", 41, 150)'))
play_env <- opals$local1$envir
assign('a', play_env$iris$Petal.Length, envir = play_env)
assign('b', factor(c(rep('category1',10), rep('category2',100))), envir = play_env)
#now play around:
dssSubsetByClass('iris', variables = 'iris$Species', datasources = opals)
str(play_env$subClasses)
dssSubsetByClass('iris', variables = c('iris$Species', 'b'), datasources = opals)
str(play_env$subClasses)
dssSubsetByClass(c('iris', 'a'), variables = c('iris$Species', 'b'), keep.cols = c('Sepal.Length', 'Sepal.Width', 'a'), datasources = opals)
str(play_env$subClasses)
dssSubsetByClass('a', variables = 'b', keep.cols = c('a'), datasources = opals)
str(play_env$subClasses)

IulianD/dsSwissKnifeClient documentation built on June 23, 2020, 4:38 p.m.