setprefix: setprefix

Description Usage Arguments Details See Also Examples

View source: R/setprefix.R

Description

set/change prefix on column names

Usage

1
setprefix(x, old, new)

Arguments

x

data.table

old

string possibly a regex (there is no need to add "^")

new

string

Details

setprefix works similar to setnames but works only on the beginning of names not the whole names by swapping out the beginning.

See Also

setnames

Examples

1
2
3
x <-data.table( i.x=1:10, i.y=1:10 )
x %>% setprefix( "i.", "x." )
names(x)

decisionpatterns/data.table.plus documentation built on June 15, 2020, 10:26 p.m.