ag.createfactor.ds: Generates a factor variable

Description Usage Arguments Value Author(s) Examples

Description

The functions uses the input vector to generate a factor vector. The generate factor is checked and if valid (no category with count > 0 and < 5) returned; if not valid an empty of the same length is returned.

Usage

1
2
  ag.createfactor.ds(xvect, levels = NULL, labels = levels,
    exclude = NA, ordered = is.ordered(xvect))

Arguments

xvect

a numerical or character vector

levels

optional vector of values that 'xvect' might have taken

labels

labels for the different levels

exclude

values to be excluded

ordered

tells if the variable 'x' is ordered

Value

a 'valid' factor vector or an empty vector of the same length.

Author(s)

Gaye, A.; Burton, P.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
# load the login data
data(logindata)

# login and assign specific variable(s)
myvar <- list("GENDER")
opals <- ag.ds.login(logins=logindata,assign=TRUE,variables=myvar)

# generate a factor vector using the variable 'GENDER'
datashield.assign(opals, "sex", quote(ag.createfactor.ds(D$GENDER)))

# display the number of observation in each vector
datashield.aggregate(opals, quote(length(sex)))
 
## End(Not run)

datashield/ag.dev.sv documentation built on May 14, 2019, 7:46 p.m.