rez_mutate: Mutate a Rez data.frame and change field access status.

View source: R/rezrDF_mutate.R

rez_mutateR Documentation

Mutate a Rez data.frame and change field access status.

Description

This is a wrapper for performing mutations on Rez data.frames, including validation to ensure you do not change anything you shouldn't change. It only changes the data frame, such as by changing field access data, at the moment. If your desired fieldaccess value is flex, this may serve as a drop-in replacement for mutate. Note that apart from the data.frame to be modified, all arguments of mutate must be named. Currently does not work with across, so you will have to stick to mutate for that. You may validate the fields beforehand using rez_validate_fieldchange.

Usage

rez_mutate(df, ..., fieldaccess = "")

Arguments

df

The data frame to be modified.

...

Other functions passed onto mutate, i.e. the columns you will be changing or adding.

fieldaccess

The field access status of the field you're addding, either a single character (to apply to all of the new fields) or a vector of characters for each new field. Note that if you are both modifying and adding fields, only the added fields will have access values changed. So if you're specifying an entire vector of field access values, the best practice in using this function is to separate new-field and added-field mutates, otherwise the code will be difficult to read.

Value

resultDF

Note

If fieldaccess is not set, it will be set to flex for NEW fields. Old fields will remain unchanged. Note that this is different behaviour from changeField, which changes field access status to 'flex' by default if field access is not given.

Examples

sbc007$trackDF$default = sbc007$trackDF$default %>% rez_mutate(charLength = nchar(text))

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