set_cols: Internally looped 'set()'

Description Usage Arguments See Also Examples

View source: R/set_cols.R

Description

A convenience function implementing set looped over columns of a data.frame. Modification is fast (by reference) but cannot include grouping operations.

Usage

1
set_cols(x, FUN, i = NULL, j = NULL)

Arguments

x

a data.frame.

FUN

a function to be applied to all x[i, j].

i

integer indices indicating rows to update.

j

column names or integer indices indicating columns to update. The default updates all columns.

See Also

:=.

Examples

1
2
3
df <- data.frame(a = letters, b = LETTERS, c = LETTERS,
                 stringsAsFactors = FALSE)
set_cols(df, FUN = tolower)

coletl/coler documentation built on May 12, 2021, 9:44 p.m.