shift_row_values: Shift row values left or right

Description Usage Arguments Value Examples

View source: R/shift_row_values.R

Description

Shift row values left or right

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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")

daranzolin/hacksaw documentation built on April 14, 2021, 6:32 a.m.