Skip to contents

Easily add a field to / change a field in a rezrDF using information from another rezrDF. Has two variants that may be applied to rezrDFs or rezrObjs,

Usage

addFieldForeign(x, ...)

changeFieldForeign(x, ...)

# S3 method for rezrDF
addFieldForeign(
  targetDF,
  sourceDF,
  targetForeignKeyName,
  targetFieldName = "",
  sourceFieldName = "",
  type = "simple",
  fieldaccess = "flex",
  complexAction = NULL,
  targetNodeMap = NULL
)

# S3 method for rezrDF
changeFieldForeign(
  targetDF,
  sourceDF,
  targetForeignKeyName,
  targetFieldName = "",
  sourceFieldName = "",
  type = "simple",
  fieldaccess = "flex",
  complexAction = NULL,
  targetNodeMap = NULL
)

# S3 method for rezrObj
addFieldForeign(
  rezrObj,
  targetEntity,
  targetLayer = "",
  sourceEntity,
  sourceLayer = "",
  targetForeignKeyName,
  targetFieldName = "",
  sourceFieldName = "",
  type = "simple",
  fieldaccess = "flex",
  complexAction = NULL,
  sourceKeyName = ""
)

# S3 method for rezrObj
changeFieldForeign(
  rezrObj,
  targetEntity,
  targetLayer = "",
  sourceEntity,
  sourceLayer = "",
  targetForeignKeyName,
  targetFieldName = "",
  sourceFieldName = "",
  type = "simple",
  fieldaccess = "flex",
  complexAction = NULL
)

Arguments

targetDF

The rezrDF you will be changing.

sourceDF

The rezrDF you will be getting information from.

targetForeignKeyName

The name of the field in the target DF that corresponds to the key (ID) of the source DF. If type = "simple", this is a column in the rezrDF. If type = "complex", this is a field in the target node map, and targetNodeMap must be specified.

targetFieldName

The name of the field you want to add / change.

sourceFieldName

The name of the field in the source rezrDF that you will be pulling information from.

type

If "simple", each row of the target DF gets information from only one row of the source DF. If "complex", each row of the target DF gets information from multiple rows of the source DF.

fieldaccess

The field access value you want to set to the new / changed field.

complexAction

When type = "complex", the action that will aggregate the values from the source DF together. See concatenateAll for ideas.

targetNodeMap

The node map corresponding to the target DF. It only needs to be specified when type = "complex".

rezrObj

The rezrObj that you will be changing.

targetEntity

The Rezonator entity that you will be changing (e.g. token, unit, entry ...)

targetLayer

The layer of the Rezonator entity that you will be changing from. Leave blank for entities without layers (e.g. token, entry and unit). If you don't have layers for entities that may have layers (i.e. track, rez, chunk), type 'default'.

sourceEntity

The Rezonator entity that you will be getting your information from.

sourceLayer

The layer of the Rezonator entity that you will be changing from. Leave blank for entities without layers (e.g. token, entry and unit). If you don't have layers for entities that may have layers (i.e. track, rez, chunk), type 'default'.

sourceKeyName

The key from the source rezrDF to be used, when not the default primary key.

Value

When applied on a rezrDF, a rezrDF object with the added / changed field.

When applied on a rezrObj, the rezrObj with the change applied on the rezrDF.

Note

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.