shift.column: shift.column

Description Usage Arguments Details Value Author(s) Examples

View source: R/shiftColumn.r

Description

Shift a column of data

Usage

1
2
shift.column(data, columns, newNames = sprintf("%s.Shifted", columns),
  len = 1L, up = TRUE)

Arguments

data

data.frame

columns

Character vector specifying which columns to shift.

newNames

Character vector specifying new names for the columns that will be created by the shift. Must be same length as columns.

len

Integer specifying how many rows to shift the data.

up

logical indicating if rows should be shifted up or down.

Details

Shifts a column of data up or down a certain number of rows

Value

data.frame with the specified columns shifted.

Author(s)

Jared P. Lander

Examples

1
2
3
myData <- data.frame(Upper=LETTERS, lower=letters)
shift.column(data=myData, columns="lower")
shift.column(data=myData, columns="lower", len=2)

useful documentation built on Oct. 8, 2018, 5:04 p.m.