add_to: add_to

View source: R/add_to.R

add_toR Documentation

add_to

Description

add_to

Usage

add_to(x, ...)

## S3 method for class 'list'
add_to(x, ...)

## S3 method for class 'data.frame'
add_to(x, ...)

Arguments

x

Dataframe or list

...

what to add

Value

data.frame or list

Examples


#' Eine oder mehere Zeilen zu einem data.fram hinzufügen

df <-   data.frame(
  Source = c("A", "B", "C", "F"),
  x = 1:4,
  y = 1:4,
  stringsAsFactors = FALSE
)

df
add_to(df, "Erste Zeile" = 1, "Dritte" = 3)
add_to(df, "Erste Zeile" = 1, "letzte" = -1)
add_to(df, list("G", 5), pos = -1)
add_to(df, data.frame(Source = c("G", "H"), x = 5:6), pos = -1)


# add something to list
 
my_setting <- list(
  a = list(alpha = 1, col = "2"),
  b = list(alpha = 1, col = "2"),
  c = list(alpha = 1, col = "2")
)
my_setting <- add_to(my_setting,
                    c = list(fill = "gray80"),
                    b = list(alpha = 2, beta = 3))
my_setting$c

 # tibble::add_column(.data )

stp4/stp25tools documentation built on Feb. 27, 2025, 11:14 p.m.