acFieldLocal: Easily add a field to / change a field in a rezrDF using only...

addFieldLocalR Documentation

Easily add a field to / change a field in a rezrDF using only information from that rezrDF

Description

Easily add a field to / change a field in a rezrDF using only information from that rezrDF

Easily add a field to / change a field in a rezrDF from a rezrObj using only information from that rezrDF

Usage

addFieldLocal(x, ...)

changeFieldLocal(x, ...)

## S3 method for class 'rezrDF'
addFieldLocal(
  rezrDF,
  fieldName,
  expression,
  type = "simple",
  fieldaccess = "flex",
  groupField = ""
)

## S3 method for class 'rezrDF'
changeFieldLocal(
  rezrDF,
  fieldName,
  expression,
  type = "simple",
  fieldaccess = "",
  groupField = ""
)

## S3 method for class 'rezrObj'
addFieldLocal(
  rezrObj,
  entity,
  layer,
  fieldName,
  expression,
  type = "simple",
  fieldaccess = "flex",
  groupField = ""
)

## S3 method for class 'rezrObj'
changeFieldLocal(
  rezrObj,
  entity,
  layer,
  fieldName,
  expression,
  type = "simple",
  fieldaccess = "flex",
  groupField = ""
)

Arguments

x

The object (rezrDF or rezrObj) to be modified.

...

Arguments to be passed to the four specific functions.

rezrDF

The rezrDF object you would like to change.

fieldName

The name of the field you would like to add or change.

expression

An R expression. For example, if you would like to add the columns a and b of the rezrDF together, type a + b.

fieldaccess

The access value that you would like to assign to the new or changed field.

rezrObj

The rezrObj that you will be changing.

entity

The name of the Rezonator entity that you will be changing - track, rez, chunk, token, unit, stack, etc.

layer

The name of the layer of the Rezonator entity that you wil be changing. Leave blank for entities without layers (i.e. token, entry and unit). If you don't have layers for other entities, type 'default'.

Value

When used on a rezrDF, the rezrDF with the new or changed field.

When used on rezrObjs, a rezrObj with the changed rezrDF.

Note

changeFieldLocal and changeFieldForeign will set the field access status of the changed fields to 'flex' by default, even if they are originally auto or foreign. Please specify fieldaccess = 'auto' or 'foreign' if you want the changed fields to change to or maintain these statuses. (This is to ensure you are aware of the fact that you are changing the update function in these cases.) changeField does not support changing an auto or foreign field's value without changing its field access status or update function, as this is generally a mistake; if you must do it, use rez_mutate.')

There are no major differences between rezrDFs and rezrObjs. However, only the rezrDF variant can be applied on emancipated rezrDFs (rezrDFs that do not belong to a rezrObj), whereas the rezrObj variant is more elegant when working with rezrDFs within a rezrObj.


johnwdubois/rezonateR documentation built on Nov. 19, 2024, 11:17 p.m.