Learn R Programming

rearrr (version 0.3.4)

Transformation: Transformation

Description

lifecycle::badge("experimental")

Container for the type of transformation used in Pipeline.

Note: For internal use.

Arguments

Author

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

Public fields

name

Name of transformation.

fn

Transformation function.

args

list of arguments for `fn`.

group_cols

Names of columns to group data.frame by before applying `fn`.

When `NULL`, the data.frame is not grouped.

Methods


Method new()

Initialize transformation.

Usage

Transformation$new(fn, args, name = NULL, group_cols = NULL)

Arguments

fn

Transformation function.

args

list of arguments for `fn`.

name

Name of transformation.

group_cols

Names of columns to group data.frame by before applying `fn`.

When `NULL`, the data.frame is not grouped.


Method apply()

Apply the transformation to a data.frame.

Usage

Transformation$apply(data)

Arguments

data

data.frame.

A grouped data.frame will first be ungrouped. If `group_cols` is specified, it will then be grouped by those columns.

Returns

Transformed version of `data`.


Method print()

Print an overview of the transformation.

Usage

Transformation$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

Transformation$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

Other transformation classes: FixedGroupsTransformation, GeneratedTransformation