shift_row_values {hacksaw}R Documentation

Shift row values left or right

Description

Shift row values left or right

Usage

shift_row_values(.data, .dir = "left", at = NULL)

Arguments

.data

a table of data.

.dir

the shift direction as a string, one of "left" or "right".

at

the row indices at which to shift.

Value

a data frame.

Examples

library(dplyr)
df <- tibble(
    s = c(NA, 1, NA, NA),
    t = c(NA, NA, 1, NA),
    u = c(NA, NA, 2, 5),
    v = c(5, 1, 9, 2),
    x = c(1, 5, 6, 7),
    y = c(NA, NA, 8, NA),
    z = 1:4
)
df %>% shift_row_values()
df %>% shift_row_values(at = 1:3)
df %>% shift_row_values(at = 1:2, .dir = "right")

[Package hacksaw version 0.0.2 Index]