Learn R Programming

rearrr (version 0.3.5)

FixedGroupsTransformation: FixedGroupsTransformation

Description

lifecycle::badge("experimental")

Container for the type of transformation used in FixedGroupsPipeline.

Note: For internal use.

Arguments

Author

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

Super class

rearrr::Transformation -> FixedGroupsTransformation

Public fields

name

Name of transformation.

fn

Transformation function.

args

list of constant arguments for `fn`.

var_args

list of arguments for `fn` with different values per group.

num_groups

Number of groups that the transformation expects.

apply_arg

list of TRUE/FALSE flags indicating whether the transformation should be applied to each of the groups.

When `NULL`, the transformation is applied to all groups.

Methods


Method new()

Initialize transformation.

Usage

FixedGroupsTransformation$new(fn, args, var_args, name = NULL)

Arguments

fn

Transformation function.

args

list of constant arguments for `fn`.

var_args

list of arguments for `fn` with different values per group. Each argument should have a list of values (one per group).

By adding ".apply" with a list of TRUE/FALSE flags, the transformation can be disabled for a specific group.

E.g. list(".apply" = list(TRUE, FALSE, TRUE), ....

name

Name of transformation.


Method get_group_args()

Get arguments for specific group ID.

Usage

FixedGroupsTransformation$get_group_args(group_id)

Arguments

group_id

ID of the group to get arguments for.

Returns

list of arguments.


Method apply()

Apply the transformation to a data.frame.

Usage

FixedGroupsTransformation$apply(data)

Arguments

data

data.frame with the expected number of groups.

Returns

Transformed version of `data`.


Method print()

Print an overview of the transformation.

Usage

FixedGroupsTransformation$print(..., indent = 0, show_class = TRUE)

Arguments

...

further arguments passed to or from other methods.

indent

How many spaces to indent when printing.

show_class

Whether to print the transformation class name.

Returns

The pipeline. To allow chaining of methods.


Method clone()

The objects of this class are cloneable with this method.

Usage

FixedGroupsTransformation$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

Other transformation classes: GeneratedTransformation, Transformation