DataSHIELD implementation of dplyr::mutate.

ds.if_else(
  condition = NULL,
  true = NULL,
  false = NULL,
  missing = NULL,
  ptype = NULL,
  size = NULL,
  newobj = NULL,
  datasources = NULL
)

Arguments

condition

A list, specifying a logical vector in `tidy-select` syntax, ie data and column names unquoted.

true

Vector to use for TRUE value of condition.

false

Vector to use for FALSE value of condition.

missing

If not NULL, will be used as the value for NA values of condition. Follows the same size and type rules as true and false.

ptype

An optional prototype declaring the desired output type. If supplied, this overrides the common type of true, false, and missing.

size

An optional size declaring the desired output size. If supplied, this overrides the size of condition.

newobj

Character specifying name for new server-side data frame.

datasources

datashield connections object.

Value

One or more new columns created on the serverside data frame specified in the newobj.

Details

Performs dplyr mutate

Examples

if (FALSE) {
## First log in to a DataSHIELD session with mtcars dataset loaded.

ds.if_else(
  condition = list(mpg_trans = cyl * 1000, new_var = (hp - drat) / qsec),
  true = "high",
  false = "low",
  newobj = "new_var"
)

## Refer to the package vignette for more examples.
}