to_last_position: Bring a Column to the Last Position

Description Usage Arguments See Also Examples

View source: R/position.R

Description

Bring a Column to the Last Position

Usage

1

Arguments

data

A dataframe or tibble.

col

Target column.

See Also

select, bind_cols, reexports,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
library(tidyverse)
test_data <- 
        tibble(A = sample(c(NA_integer_, 1:3), size = 10, replace = TRUE),
               B = sample(c(NA_integer_, 4:6), size = 10, replace = TRUE),
               C = sample(c(NA_integer_, 7:9), size = 10, replace = TRUE),
               D = sample(c(NA_integer_, 10:12), size = 10, replace = TRUE),
               E = sample(c(NA_integer_, 13:15), size = 10, replace = TRUE),
               )


# To Position 1
to_position_1(data = test_data,
              col = D)

# To Last Position
to_last_position(data = test_data,
                 col = B)


# To Last Position
to_position_n(data = test_data,
              col = B,
              n = 3)

to_position_n(data = test_data,
              col = B,
              n = 4)

to_position_n(data = test_data,
              col = B,
              n = 2)

meerapatelmd/rubix documentation built on Sept. 5, 2021, 8:30 p.m.