Helper function: copy column
Examples
# Beispiel-Tibble
tb <- tibble::tibble(
ID = 1:5,
Wert = c(10, 20, 30, 40, 50)
)
# Anwendung der Funktion
tb_neu <- copy_column(tb, "Wert", 3)
print(tb_neu)
#> # A tibble: 5 × 5
#> ID Wert Wert_2 Wert_3 Wert_4
#> <int> <dbl> <dbl> <dbl> <dbl>
#> 1 1 10 10 10 10
#> 2 2 20 20 20 20
#> 3 3 30 30 30 30
#> 4 4 40 40 40 40
#> 5 5 50 50 50 50