powered by
Shift a column of data
shift.column(data, columns, newNames = sprintf("%s.Shifted", columns), len = 1L, up = TRUE)
data.frame
Character vector specifying which columns to shift.
Character vector specifying new names for the columns that will be created by the shift. Must be same length as columns.
columns
Integer specifying how many rows to shift the data.
logical indicating if rows should be shifted up or down.
data.frame with the specified columns shifted.
Shifts a column of data up or down a certain number of rows
# NOT RUN { myData <- data.frame(Upper=LETTERS, lower=letters) shift.column(data=myData, columns="lower") shift.column(data=myData, columns="lower", len=2) # }
Run the code above in your browser using DataLab