Description Usage Arguments See Also Examples
Bring a Column to the Last Position
1 |
data |
A dataframe or tibble. |
col |
Target column. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.